svn commit: r264436 - head/lib/libproc

Mark Johnston markj at FreeBSD.org
Mon Apr 14 00:24:05 UTC 2014


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);


More information about the svn-src-head mailing list