Re: kern/60620: Fatal logic inversion in fdtbus_get_u32prop_with_default() breaks usmsc(4) and other FDT drivers
"Jun Ebihara 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: Jun Ebihara <[email protected]> To: [email protected] Cc: [email protected], [email protected], [email protected] 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 17:48:20 +0900 Thanx! 20260818180311Z seems fine! $ ./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 armv7$ uname -a NetBSD armv7 11.99.7 NetBSD 11.99.7 (GENERIC) #0: Tue Aug 18 18:03:11 UTC 2026 [email protected]:/usr/src/sys/arch/evbarm/compile/GENER= IC evbarm 2026=E5=B9=B48=E6=9C=8819=E6=97=A5(=E6=B0=B4) 17:05 Nick Hudson via gnats <= [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 = =3D > 1.43) > > with the implementation of fdtbus_get_u32prop_with_default(). > > The internal logic of of_getprop_uint32() return value checking is =3D > inverted: > > ---------------------------------------------------------------------- > > static int > > fdtbus_get_u32prop_with_default(int phandle, const char *prop, int =3D > dflt) > > { > > uint32_t val; > > if (of_getprop_uint32(phandle, prop, &val)) { > > val =3D3D 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= =3D > 2026 =3D > [email protected]:/Volumes/Work/netbsd/nick-vchiq/obj.evbarmv= 7h=3D > f-el/sys/arch/evbarm/compile/GENERIC evbarm > $ gcc -v > Using built-in specs. > COLLECT_GCC=3D3Dgcc > COLLECT_LTO_WRAPPER=3D3D/usr/libexec/lto-wrapper > Target: armv7--netbsdelf-eabihf > Configured with: =3D > /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure =3D > --target=3D3Darmv7--netbsdelf-eabihf --enable-long-long --enable-threads= =3D > --with-bugurl=3D3Dhttp://www.NetBSD.org/support/send-pr.html =3D > --with-pkgversion=3D3D'NetBSD nb1 20250721' --with-system-zlib =3D > --enable-__cxa_atexit --enable-libstdcxx-time=3D3Drt =3D > --enable-libstdcxx-threads --with-diagnostics-color=3D3Dauto-if-env =3D > --with-default-libstdcxx-abi=3D3Dnew =3D > --with-isl=3D3D/var/obj/mknative/evbarm-earmv7hf/usr/src/tooldir.NetBSD-= 10.0=3D > _STABLE-amd64 =3D > --with-mpc-lib=3D3D/var/obj/mknative/evbarm-earmv7hf/usr/src/external/lg= pl3/=3D > mpc/lib/libmpc =3D > --with-mpfr-lib=3D3D/var/obj/mknative/evbarm-earmv7hf/usr/src/external/l= gpl3=3D > /mpfr/lib/libmpfr =3D > --with-gmp-lib=3D3D/var/obj/mknative/evbarm-earmv7hf/usr/src/external/lg= pl3/=3D > gmp/lib/libgmp --with-mpc-include=3D3D/usr/src/external/lgpl3/mpc/dist/s= rc =3D > --with-mpfr-include=3D3D/usr/src/external/lgpl3/mpfr/dist/src =3D > --with-gmp-include=3D3D/usr/src/external/lgpl3/gmp/lib/libgmp/arch/arm = =3D > --enable-tls --enable-initfini-array --disable-multilib =3D > --disable-libstdcxx-pch --build=3D3Darmv7--netbsdelf-eabihf =3D > --host=3D3Darmv7--netbsdelf-eabihf =3D > --with-sysroot=3D3D/var/obj/mknative/evbarm-earmv7hf/usr/src/destdir.evb= arm > 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 > =3D3D=3D3D=3D3D FDT Regression Test Bench =3D3D=3D3D=3D3D > > [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 > > =3D3D=3D3D=3D3D Test finished =3D3D=3D3D=3D3D > $ > > Will check -current shortly > --=20 Jun Ebihara