#2878 closed defect (fixed)

src/c/src/lib/libbsp/sparc/shared/can/occan.c:1573: broken error checking ?

Reported by: David Binderman Owned by: Daniel Hellstrom
Priority: normal Milestone: 5.1
Component: arch/sparc Version: 4.11
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

src/c/src/lib/libbsp/sparc/shared/can/occan.c:1573]: (style) Checking if unsigned variable 'speed=pelican_speed_auto(can)' is less than zero.

Source code is

if ( (speed=pelican_speed_auto(can)) < 0 ){

/* failed */
return RTEMS_IO_ERROR;

}

but

unsigned int speed;

and

static int pelican_speed_auto(occan_priv *priv);

I am not sure which C compiler gets using in rtems, but I do
know that gcc compiler flag -Wtype-limits will flag this
kind of problem.

Change History (6)

comment:1 Changed on Jan 20, 2017 at 2:14:52 PM by Sebastian Huber

Owner: set to Daniel Hellstrom
Status: newassigned

comment:2 Changed on May 11, 2017 at 7:31:02 AM by Sebastian Huber

Milestone: 4.124.12.0

comment:3 Changed on Aug 22, 2017 at 8:35:33 AM by Daniel Hellstrom

Hi,
This might not generated a warning because it is part of dead code that will never be reached due to the return statement just above. I have made a patch to remove this dead code, it will close this ticket.

comment:4 Changed on Aug 30, 2017 at 10:40:05 AM by Daniel Hellstrom

Resolution: fixed
Status: assignedclosed

comment:5 Changed on Oct 16, 2017 at 6:23:46 AM by Sebastian Huber

Component: unspecifiedarch/sparc

comment:6 Changed on Nov 9, 2017 at 6:27:14 AM by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.