Re: kern/60620: Fatal logic inversion in fdtbus_get_u32prop_with_default() breaks usmsc(4) and other FDT drivers
"Nick Hudson via gnats" <[email protected]>
| Newsgroups | gmane.os.netbsd.bugs |
|---|---|
| Message-ID | <[email protected]> |
The following reply was made to PR kern/60620; it has been noted by GNATS. From: Nick Hudson <[email protected]> To: [email protected], [email protected], [email protected], [email protected] Cc: Subject: Re: kern/60620: Fatal logic inversion in fdtbus_get_u32prop_with_default() breaks usmsc(4) and other FDT drivers Date: Wed, 19 Aug 2026 09:01:58 +0100 On 19/08/2026 06:05, [email protected] via gnats wrote: [snip] > A fatal regression was introduced in sys/dev/fdt/fdt_subr.c (revision = 1.43) > with the implementation of fdtbus_get_u32prop_with_default(). > The internal logic of of_getprop_uint32() return value checking is = inverted: > ---------------------------------------------------------------------- > static int > fdtbus_get_u32prop_with_default(int phandle, const char *prop, int = dflt) > { > uint32_t val; > if (of_getprop_uint32(phandle, prop, &val)) { > val =3D dflt; > } > return val; > } This isn't a bug. Also, $ uname -a NetBSD rpi2 11.99.7 NetBSD 11.99.7 (GENERIC) #0: Sun Aug 16 16:46:12 BST = 2026 = [email protected]:/Volumes/Work/netbsd/nick-vchiq/obj.evbarmv7h= f-el/sys/arch/evbarm/compile/GENERIC evbarm $ gcc -v Using built-in specs. COLLECT_GCC=3Dgcc COLLECT_LTO_WRAPPER=3D/usr/libexec/lto-wrapper Target: armv7--netbsdelf-eabihf Configured with: = /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure = --target=3Darmv7--netbsdelf-eabihf --enable-long-long --enable-threads = --with-bugurl=3Dhttp://www.NetBSD.org/support/send-pr.html = --with-pkgversion=3D'NetBSD nb1 20250721' --with-system-zlib = --enable-__cxa_atexit --enable-libstdcxx-time=3Drt = --enable-libstdcxx-threads --with-diagnostics-color=3Dauto-if-env = --with-default-libstdcxx-abi=3Dnew = --with-isl=3D/var/obj/mknative/evbarm-earmv7hf/usr/src/tooldir.NetBSD-10.0= _STABLE-amd64 = --with-mpc-lib=3D/var/obj/mknative/evbarm-earmv7hf/usr/src/external/lgpl3/= mpc/lib/libmpc = --with-mpfr-lib=3D/var/obj/mknative/evbarm-earmv7hf/usr/src/external/lgpl3= /mpfr/lib/libmpfr = --with-gmp-lib=3D/var/obj/mknative/evbarm-earmv7hf/usr/src/external/lgpl3/= gmp/lib/libgmp --with-mpc-include=3D/usr/src/external/lgpl3/mpc/dist/src = --with-mpfr-include=3D/usr/src/external/lgpl3/mpfr/dist/src = --with-gmp-include=3D/usr/src/external/lgpl3/gmp/lib/libgmp/arch/arm = --enable-tls --enable-initfini-array --disable-multilib = --disable-libstdcxx-pch --build=3Darmv7--netbsdelf-eabihf = --host=3Darmv7--netbsdelf-eabihf = --with-sysroot=3D/var/obj/mknative/evbarm-earmv7hf/usr/src/destdir.evbarm Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.5.0 (nb3 20260326) $ gcc -Wall -o test_fdt test_fdt_subr.c $ ./test_fdt =3D=3D=3D FDT Regression Test Bench =3D=3D=3D [Case 1] Property EXISTS (Expected output: 200) - ORIGINAL (Buggy): 200 --> PASS - FIXED (Patch): 200 --> PASS [Case 2] Property DOES NOT EXIST (Expected output: 100) - ORIGINAL (Buggy): 100 --> PASS - FIXED (Patch): 100 --> PASS =3D=3D=3D Test finished =3D=3D=3D $ Will check -current shortly