#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 01/20/17 at 14:14:52 by Sebastian Huber

Owner: set to Daniel Hellstrom
Status: newassigned

comment:2 Changed on 05/11/17 at 07:31:02 by Sebastian Huber

Milestone: 4.124.12.0

comment:3 Changed on 08/22/17 at 08:35:33 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 08/30/17 at 10:40:05 by Daniel Hellstrom

Resolution: fixed
Status: assignedclosed

comment:5 Changed on 10/16/17 at 06:23:46 by Sebastian Huber

Component: unspecifiedarch/sparc

comment:6 Changed on 11/09/17 at 06:27:14 by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.