Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Apr 2014 00:24:05 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264436 - head/lib/libproc
Message-ID:  <201404140024.s3E0O5YW024183@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Mon Apr 14 00:24:04 2014
New Revision: 264436
URL: http://svnweb.freebsd.org/changeset/base/264436

Log:
  Fix some off-by-one errors. The kve_end and rdl_eaddr fields contain the
  first address after the end of the map entry and should therefore be
  excluded.
  
  MFC after:	2 weeks

Modified:
  head/lib/libproc/proc_sym.c

Modified: head/lib/libproc/proc_sym.c
==============================================================================
--- head/lib/libproc/proc_sym.c	Mon Apr 14 00:23:18 2014	(r264435)
+++ head/lib/libproc/proc_sym.c	Mon Apr 14 00:24:04 2014	(r264436)
@@ -96,7 +96,7 @@ proc_objname(struct proc_handle *p, uint
 
 	for (i = 0; i < p->nobjs; i++) {
 		rdl = &p->rdobjs[i];
-		if (addr >= rdl->rdl_saddr && addr <= rdl->rdl_eaddr) {
+		if (addr >= rdl->rdl_saddr && addr < rdl->rdl_eaddr) {
 			strlcpy(objname, rdl->rdl_path, objnamesz);
 			return (objname);
 		}
@@ -176,7 +176,7 @@ proc_addr2map(struct proc_handle *p, uin
 			kve = kves + i;
 			if (kve->kve_type == KVME_TYPE_VNODE)
 				lastvn = i;
-			if (addr >= kve->kve_start && addr <= kve->kve_end) {
+			if (addr >= kve->kve_start && addr < kve->kve_end) {
 				if ((map = malloc(sizeof(*map))) == NULL) {
 					free(kves);
 					return (NULL);
@@ -209,7 +209,7 @@ proc_addr2map(struct proc_handle *p, uin
 
 	for (i = 0; i < p->nobjs; i++) {
 		rdl = &p->rdobjs[i];
-		if (addr >= rdl->rdl_saddr && addr <= rdl->rdl_eaddr) {
+		if (addr >= rdl->rdl_saddr && addr < rdl->rdl_eaddr) {
 			if ((map = malloc(sizeof(*map))) == NULL)
 				return (NULL);
 			proc_rdl2prmap(rdl, map);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404140024.s3E0O5YW024183>