MFC r264436:

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.
This commit is contained in:
markj 2014-04-29 03:36:04 +00:00
parent 3e706bc125
commit 652284a343

View File

@ -96,7 +96,7 @@ proc_objname(struct proc_handle *p, uintptr_t addr, char *objname,
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, uintptr_t addr)
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, uintptr_t addr)
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);