Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jan 2025 15:04:44 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 7554746c43c5 - main - libdevinfo: Avoid false positives for the root0 sentinel value
Message-ID:  <202501291504.50TF4ide032548@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=7554746c43c50d99d15bb63ff43c90e561a9792e

commit 7554746c43c50d99d15bb63ff43c90e561a9792e
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-01-29 15:03:59 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-01-29 15:03:59 +0000

    libdevinfo: Avoid false positives for the root0 sentinel value
    
    Previously, a NULL pointer value was used to request the root0 device
    at the top of the device tree.  However, this meant that resource
    ranges from a rman with a NULL device pointer were annotated as being
    owned by root0 instead of being unowned.  Switch to a different value
    for root0's sentinel to avoid the clash.
    
    Since this is an ABI change, bump the SHLIB_MAJOR for libdevinfo to 7.
    
    Reported by:    jrtc27
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D48675
---
 ObsoleteFiles.inc        | 3 +++
 lib/libdevinfo/Makefile  | 2 +-
 lib/libdevinfo/devinfo.c | 2 +-
 lib/libdevinfo/devinfo.h | 2 +-
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index b406c3e281f1..8fc9e6f4e152 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -51,6 +51,9 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 2025xxxx: libdevinfo bumped to version 7
+OLD_LIBS+=lib/libdevinfo.so.6
+
 # 20250123: Remove gvinum(8)
 OLD_FILES+=sbin/gvinum
 OLD_FILES+=usr/share/man/man8/gvinum.8.gz
diff --git a/lib/libdevinfo/Makefile b/lib/libdevinfo/Makefile
index 41e17f7de0be..b74806e42672 100644
--- a/lib/libdevinfo/Makefile
+++ b/lib/libdevinfo/Makefile
@@ -14,7 +14,7 @@ MLINKS+=devinfo.3 devinfo_foreach_device_resource.3
 MLINKS+=devinfo.3 devinfo_foreach_rman_resource.3
 MLINKS+=devinfo.3 devinfo_foreach_rman.3
 
-SHLIB_MAJOR=	6
+SHLIB_MAJOR=	7
 
 WARNS?=	3
 
diff --git a/lib/libdevinfo/devinfo.c b/lib/libdevinfo/devinfo.c
index 115e7ea76602..65a26d871371 100644
--- a/lib/libdevinfo/devinfo.c
+++ b/lib/libdevinfo/devinfo.c
@@ -420,7 +420,7 @@ devinfo_handle_to_device(devinfo_handle_t handle)
 	 */
 	if (handle == DEVINFO_ROOT_DEVICE) {
 		TAILQ_FOREACH(dd, &devinfo_dev, dd_link)
-		    if (dd->dd_dev.dd_parent == DEVINFO_ROOT_DEVICE)
+		    if (dd->dd_dev.dd_parent == 0)
 			    return(&dd->dd_dev);
 		return(NULL);
 	}
diff --git a/lib/libdevinfo/devinfo.h b/lib/libdevinfo/devinfo.h
index 07e2043d43ce..0d02a75195d3 100644
--- a/lib/libdevinfo/devinfo.h
+++ b/lib/libdevinfo/devinfo.h
@@ -34,7 +34,7 @@
 #include <sys/bus.h>
 
 typedef __uintptr_t	devinfo_handle_t;
-#define DEVINFO_ROOT_DEVICE	((devinfo_handle_t)0)
+#define DEVINFO_ROOT_DEVICE	((devinfo_handle_t)-1)
 
 typedef enum device_state devinfo_state_t;
 



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