Skip to content

Commit

Permalink
EDAC, sb_edac: Fix signedness bugs in *_get_ha() functions
Browse files Browse the repository at this point in the history
A static checker gave the following warnings:

  drivers/edac/sb_edac.c:1030 ibridge_get_ha() warn: signedness bug returning '(-22)'
  drivers/edac/sb_edac.c:1037 knl_get_ha() warn: signedness bug returning '(-22)'

Both because the functions are declared to return a "u8", but try to
return -EINVAL for the error case.

Fix by returning 0xff (since the caller doesn't look at, or pass on, the
return value).

Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Tony Luck <[email protected]>
Cc: Qiuxu Zhuo <[email protected]>
Cc: linux-edac <[email protected]>
Link: http://lkml.kernel.org/r/20180914201905.GA30946@agluck-desk
Signed-off-by: Borislav Petkov <[email protected]>
  • Loading branch information
aegl authored and suryasaimadhu committed Sep 15, 2018
1 parent 8489b17 commit c968ed0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/edac/sb_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1027,14 +1027,14 @@ static u8 ibridge_get_ha(u8 bank)
case 9 ... 16:
return (bank - 9) / 4;
default:
return -EINVAL;
return 0xff;
}
}

/* Not used, but included for safety/symmetry */
static u8 knl_get_ha(u8 bank)
{
return -EINVAL;
return 0xff;
}

static u64 haswell_get_tolm(struct sbridge_pvt *pvt)
Expand Down

0 comments on commit c968ed0

Please sign in to comment.