array index of '-16' indexes before the beginning of the array

2 views
Skip to first unread message

Andriy Gapon

unread,
Nov 27, 2011, 6:42:55 PM11/27/11
to FreeBSD current

Looks like clang has found a real issue here:
/usr/src/sys/x86/x86/local_apic.c:311:2: warning: array index of '-16' indexes
before the beginning of the array [-Warray-bounds]
lapics[apic_id].la_ioint_irqs[IDT_DTRACE_RET - APIC_IO_INTS] =
IRQ_DTRACE_RET;

IDT_DTRACE_RET (0x20) indeed seems to be less than APIC_IO_INTS.

--
Andriy Gapon
_______________________________________________
freebsd...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-curre...@freebsd.org"

Andriy Gapon

unread,
Nov 28, 2011, 4:20:19 AM11/28/11
to Ryan Stone, FreeBSD current
on 28/11/2011 02:59 Ryan Stone said the following:

> On Sun, Nov 27, 2011 at 6:42 PM, Andriy Gapon <a...@freebsd.org> wrote:
>>
>> Looks like clang has found a real issue here:
>> /usr/src/sys/x86/x86/local_apic.c:311:2: warning: array index of '-16' indexes
>> before the beginning of the array [-Warray-bounds]
>> lapics[apic_id].la_ioint_irqs[IDT_DTRACE_RET - APIC_IO_INTS] =
>> IRQ_DTRACE_RET;
>
> Hm, so as far as I can tell the DTrace-related code in local_apic.c is
> bogus. DTrace's interrupt vectors are 32 and 33, which aren't I/O
> vectors, so local_apic.c shouldn't need to know anything about them.
> I think that the right fix is to remove all of it from local_apic.c.

I think that those vectors fall into a range designated for PIC interrupts.
sys/i386/include/apicvar.h has a nice illustration.

Reply all
Reply to author
Forward
0 new messages