Subject: kern/36723: WD_SOFTBADSECT breaks kernel-build
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Andreas Wiese <aw-usenet@instandbesetzt.net>
List: netbsd-bugs
Date: 08/02/2007 14:25:00
>Number: 36723
>Category: kern
>Synopsis: WD_SOFTBADSECT enabled kernel build dies with compiler warnings
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Aug 02 14:25:00 +0000 2007
>Originator: Andreas Wiese
>Release: NetBSD 4.99.21
>Organization:
BSD-Crew Dresden
>Environment:
System: NetBSD schroeder.lan.instandbesetzt.net 4.99.21 NetBSD 4.99.21 (SCHROEDER) #0: Fri Jun 29 14:11:21 CEST 2007 root@schroeder.lan.instandbesetzt.net:/sys/arch/i386/compile/SCHROEDER i386
Architecture: i386
Machine: i386
>Description:
Hi, folks.
I tried to build a kernel with yesterday's HEAD.
When enabling 'option WD_SOFTBADSECT' the kernel build fails with the
following error message:
#v+
# compile SCHROEDER/wd.o
/usr/src/../obj/tooldir/bin/i386--netbsdelf-gcc -pipe -ffreestanding -fno-zero-initialized-in-bss -march=athlon -mtune=athlon -O2 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-sign-compare -Wno-pointer-sign -Wno-attributes -Wextra -Wno-unused-parameter -fno-strict-aliasing -pipe -Di386 -I. -I/usr/src/sys/contrib/dev/ath/netbsd -I/usr/src/sys/../common/include -I/usr/src/sys/arch -I/usr/src/sys -nostdinc -DCRYPTO_MD_DES_ENC -DCRYPTO_MD_DES_CBC -DCRYPTO_MD_BF_ENC -DCRYPTO_MD_BF_CBC -DLKM -DMAXUSERS=32 -D_KERNEL -D_KERNEL_OPT -I/usr/src/sys/lib/libkern/../../../common/lib/libc/quad -I/usr/src/sys/lib/libkern/../../../common/lib/libc/string -I/usr/src/sys/lib/libkern/../../../common/lib/libc/arch/i386/string -I/usr/src/sys/dist/pf -I/usr/src/sys/dist/ipf -c /usr/src/sys/dev/ata/wd.c
cc1: warnings being treated as errors
/usr/src/sys/dev/ata/wd.c: In function 'wdioctl':
/usr/src/sys/dev/ata/wd.c:1206: warning: pointer of type 'void *' used in arithmetic
*** Failed target: wd.o
[...]
#v-
Reason for this failure is a line stating
#v+
laddr += sizeof(*dbs);
#v-
where laddr is a (void*) pointer and dbs is of type (struct disk_badsectors*).
>How-To-Repeat:
echo "options WD_SOFTBADSECT" >> KERNELCONF and compile
>Fix:
--- src/sys/dev/ata/wd.c.orig 2007-08-02 15:16:15.000000000 +0200
+++ src/sys/dev/ata/wd.c 2007-08-02 15:16:47.000000000 +0200
@@ -1203,7 +1203,7 @@
break;
available -= sizeof(*dbs);
copyout(dbs, laddr, sizeof(*dbs));
- laddr += sizeof(*dbs);
+ laddr = (char *)laddr + sizeof(*dbs);
missing--;
count++;
}
--
Unnützes Wissen (»neon«, 11/04):
16. Die Kontinentaldrift kann man live auf http://www.sudftw.com/contdcam.htm
beobachten. Das Bild aktualisiert sich einmal im Jahr.