git: kern: Fix -Waddress warning in diskioctl()
Aaron LI
aly at crater.dragonflybsd.org
Tue Oct 13 04:50:41 PDT 2026
commit ea820314a019a3607306759ddf53d912c76255de
Author: Aaron LI <aly at aaronly.me>
Date: Tue Oct 13 13:59:06 2026 +0800
kern: Fix -Waddress warning in diskioctl()
This code was initially added in commit
c6ef65eafb251f9c905af44fd734cf8201087922, and I see no point of checking
'&dp->d_slice == NULL', which is always false. Just remove it to fix the
following -Waddress warning generated by GCC 12.5:
```
/usr/src/sys/kern/subr_disk.c: In function 'diskioctl':
/usr/src/sys/kern/subr_disk.c:1196:26: warning: the comparison will always evaluate as 'false' for the address of 'd_slice' will never be NULL [-Waddress]
1196 | if (&dp->d_slice == NULL || dp->d_slice == NULL ||
| ^~
In file included from /usr/src/sys/kern/subr_disk.c:92:
/usr/src/sys/sys/disk.h:140:34: note: 'd_slice' declared here
140 | struct diskslices *d_slice;
| ^~~~~~~
```
Summary of changes:
sys/kern/subr_disk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/ea820314a019a3607306759ddf53d912c76255de
--
DragonFly BSD source repository
More information about the Commits
mailing list