Date: Thu, 1 Jan 2015 21:41:59 -0800 From: Garrett Cooper <yaneurabeya@gmail.com> To: Ed Maste <emaste@freebsd.org> Cc: "Bjoern A. Zeeb" <bz@freebsd.org>, Steven Hartland <killing@multiplay.co.uk>, Warner Losh <imp@bsdimp.com>, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: asr(4) error with new clang/llvm Message-ID: <1617E706-D4A9-4778-BEFB-D943B74B4561@gmail.com> In-Reply-To: <CAPyFy2CHYiss=OtaeS2MJxqfHz_2fF5MNnQuQFc-rK1cB0Wt%2Bw@mail.gmail.com> References: <CEA82F51-9D88-4F20-A649-78AE7E5309AA@lists.zabbadoz.net> <54A61AFD.3040507@multiplay.co.uk> <CAPyFy2CHYiss=OtaeS2MJxqfHz_2fF5MNnQuQFc-rK1cB0Wt%2Bw@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On Jan 1, 2015, at 21:00, Ed Maste <emaste@freebsd.org> wrote:
> On 1 January 2015 at 23:13, Steven Hartland <killing@multiplay.co.uk> wrote:
>>
>> On 02/01/2015 01:23, Bjoern A. Zeeb wrote:
>>>
>>> Hi,
>>>
>>> you need the next line of source to see that while the union only defines
>>> Simple[1], the comparison goes up to SG_LIST (or something) which is indeed
>>> defined as 58. Cn someone fix this? This makes i386 compiles failing
>>> currently.
>>>
>>> /scratch/tmp/bz/head.svn/sys/modules/asr/../../dev/asr/asr.c:1849:29:
>>> error: array index 58 is past the end of the array (which contains 1
>>> element) [-Werror,-Warray-bounds]
>>> while ((len > 0) && (sg < &((PPRIVATE_SCSI_SCB_EXECUTE_MESSAGE)
>>> ^
>>> /scratch/tmp/bz/head.svn/sys/dev/asr/i2omsg.h:934:8: note: array 'Simple'
>>> declared here
>>> I2O_SGE_SIMPLE_ELEMENT Simple[1];
>>> ^
>>
>> If that's wrong it looks like there's also a number of calls to the macro
>> SG(SGL,Index,Flags,Buffer,Size) which are also wrong as Index is used in
>> the same way:
>> &(((PI2O_SG_ELEMENT)(SGL))->u.Simple[Index]
>>
>> There appears to be two calls to SG where Index is 1.
>>
>> I'm afraid I have no idea what the fix would be as the entire driver is very
>> voodoo like to me :(
>
> It's a variable length array in a struct / union. Other than being
> confusing and now triggering a warning after the clang update it
> should be fine.
>
> Most likely we need to build asr with -Werror disabled for that
> warning, perhaps -Wno-error-array-bounds. I'll take a look tomorrow
> morning if nobody else gets to it first.
It looks like more fallout from bsd.sys.mk being removed from bad.kmod.mk (NO_WARRAY_BOUNDS should be defined to the appropriate compiler flag):
1 # $FreeBSD: projects/building-blocks/sys/modules/asr/Makefile 228865 2011-12-24 17:54:58Z dim $
2
3 .PATH: ${.CURDIR}/../../dev/asr
4
5 KMOD= asr
6 SRCS= asr.c
7 SRCS+= opt_scsi.h opt_cam.h
8 SRCS+= device_if.h bus_if.h pci_if.h
9
10 .if ${MACHINE_CPUARCH} == "i386"
11 SRCS+= opt_asr.h
12 .endif
13
14 .include <bsd.kmod.mk>
15
16 CWARNFLAGS.asr.c= ${NO_WARRAY_BOUNDS}
17 CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}}
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org
iQEcBAEBCgAGBQJUpi+nAAoJEMZr5QU6S73eepYH/0IfXY/OFei6zoEMToqxOfJu
HLE06f4n3dJBJcQIWjXt8HTFMxVxasIQnkqogo1UQ9bWrjKyfoEoCkWuh8CI46N9
bF4qmrTBdFZVAuGU98yXH/whUgx6YUJNFcGW8YnfC51dgv9/q4uBdDdoMEiZ3kZm
L5gpwN/8slnh1lzKwCJEk2+MaaE9WJc6EG/wxjsPf2D3txWgMBvM3u71HnPYu7wM
0Ila9POVphAaw4rosGHFsLd73LEPGV/4+7zd+h1mJX41SJoc7iPT7+WUyUy2g5rs
EwUen0Lg4ExKG4RtlVIMCJ2vD2NTq/PnZfAT4zx1ClX9pnSOXk1DatIFUNsestY=
=WPX+
-----END PGP SIGNATURE-----
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1617E706-D4A9-4778-BEFB-D943B74B4561>
