#2875 assigned defect

src/c/src/lib/libbsp/powerpc/shared/flash/flash.c:841: broken error checking ?

Reported by: David Binderman Owned by: Needs Funding
Priority: normal Milestone: Indefinite
Component: unspecified Version: 4.11
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

src/c/src/lib/libbsp/powerpc/shared/flash/flash.c:841]: (style) Checking if unsigned variable 'got' is less than zero.

Source code is

if ( got < 0 ) {

but

while ( (got = bfill(fd, buf, b->fblksz)) > 0 && sz ) {

and

uint32_t got;

with

static int
bfill(int fd, char *buf, int size)

Suggest use local variable of type int for the return value from bfill.

Change History (2)

comment:1 Changed on Jan 20, 2017 at 1:41:04 PM by Sebastian Huber

This file is quite sloppy with integer types in general.

comment:2 Changed on Feb 15, 2017 at 2:20:42 PM by Sebastian Huber

Milestone: 4.12Indefinite
Owner: set to Needs Funding
Status: newassigned
Note: See TracTickets for help on using tickets.