Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#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 01/05/09 at 15:25:44.
Proposed patch
pr1350.diff (591 bytes) - added by Joel Sherrill on 01/06/09 at 15:27:17.
Patch #2

Download all attachments as: .zip

Change History (5)

comment:1 Changed on 01/05/09 at 15:08:10 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 01/05/09 at 15:25:44 by Joel Sherrill

Attachment: lan.diff added

Proposed patch

Changed on 01/06/09 at 15:27:17 by Joel Sherrill

Attachment: pr1350.diff added

Patch #2

comment:2 Changed on 01/06/09 at 15:27:17 by Joel Sherrill

attachments.isobsolete: 01

comment:3 Changed on 01/06/09 at 15:29:45 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.