#1350 closed defect (fixed)

arm/csb336/network/lan91c11x.c: array subscript is above array bounds

Reported by: Ralf Corsepius Owned by: Joel Sherrill
Priority: normal Milestone: 4.10
Component: bsps Version: 4.8
Severity: critical Keywords:
Cc: Blocked By:
Blocking:

Description

Using very aggressive warning flags on rtems-4.10/rtems-CVS, exposes this bug:

arm-rtems4.10-gcc --pipe -B../../../../../.././lib/
-B../../../../../.././csb336/lib/ -specs bsp_specs -qrtems -DHAVE_CONFIG_H
-isystem ../../../../../.././csb336/lib/include -DINSIDE_RTEMS_BSD_TCPIP_STACK
-Wall -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs -ansi -fasm -mcpu=arm920 -mstructure-size-boundary=8

-O2 -g -MT network_rel-lan91c11x.o -MD -MP -MF .deps/network_rel-lan91c11x.Tpo -c

-o network_rel-lan91c11x.o test -f 'network/lan91c11x.c' || echo '../../../../../../../../../rtems.work/c/src/lib/libbsp/arm/csb336/'network/lan91c11x.c
../../../../../../../../../rtems.work/c/src/lib/libbsp/arm/csb336/network/lan91c11x.c: In function 'lan91c11x_write_phy_reg':
../../../../../../../../../rtems.work/c/src/lib/libbsp/arm/csb336/network/lan91c11x.c:228: warning: array subscript is above array bounds
mv -f .deps/network_rel-lan91c11x.Tpo .deps/network_rel-lan91c11x.Po

GCC's warning is right.

The location it warns about, expands to
bits[64] = ...
which is "one index beyon array bounds" (bit[64]).

Unfortunately, I don't understand enough about this piece of code to be able to fix it.

Affected: rtems-4.8, 4.9 and 4.10

Attachments (2)

lan.diff (499 bytes) - added by Joel Sherrill on Jan 5, 2009 at 3:25:44 PM.
Proposed patch
pr1350.diff (591 bytes) - added by Joel Sherrill on Jan 6, 2009 at 3:27:17 PM.
Patch #2

Download all attachments as: .zip

Change History (5)

comment:1 Changed on Jan 5, 2009 at 3:08:10 PM by Ralf Corsepius

Summary: arm/csb336/network/lan91c11x.crray subscript is above array boundsarm/csb336/network/lan91c11x.c: array subscript is above array bounds

Changed on Jan 5, 2009 at 3:25:44 PM by Joel Sherrill

Attachment: lan.diff added

Proposed patch

Changed on Jan 6, 2009 at 3:27:17 PM by Joel Sherrill

Attachment: pr1350.diff added

Patch #2

comment:2 Changed on Jan 6, 2009 at 3:27:17 PM by Joel Sherrill

attachments.isobsolete: 01

comment:3 Changed on Jan 6, 2009 at 3:29:45 PM by Joel Sherrill

Resolution: fixed
Status: newclosed

Patch applied to 4.8 branch, 4.9 branch and CVS head.

Note: See TracTickets for help on using tickets.