Skip to content

Commit c011410

Browse files
Dan Carpentercminyard
authored andcommitted
ipmi: msghandler: Fix a signedness bug
The type for the completion codes should be unsigned char instead of char. If it is declared as a normal char then the conditions in __get_device_id() are impossible because the IPMI_DEVICE_IN_FW_UPDATE_ERR error codes are higher than 127. drivers/char/ipmi/ipmi_msghandler.c:2449 __get_device_id() warn: impossible condition '(bmc->cc == 209) => ((-128)-127 == 209)' Fixes: f8910ff ("ipmi:msghandler: retry to get device id on an error") Signed-off-by: Dan Carpenter <[email protected]> Message-Id: <20200918142756.GB909725@mwanda> Signed-off-by: Corey Minyard <[email protected]>
1 parent 42d8a34 commit c011410

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/char/ipmi/ipmi_msghandler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ struct bmc_device {
319319
int dyn_guid_set;
320320
struct kref usecount;
321321
struct work_struct remove_work;
322-
char cc; /* completion code */
322+
unsigned char cc; /* completion code */
323323
};
324324
#define to_bmc_device(x) container_of((x), struct bmc_device, pdev.dev)
325325

drivers/char/ipmi/ipmi_si_intf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ static int try_get_dev_id(struct smi_info *smi_info)
13441344
resp + 2, resp_len - 2, &smi_info->device_id);
13451345
if (rv) {
13461346
/* record completion code */
1347-
char cc = *(resp + 2);
1347+
unsigned char cc = *(resp + 2);
13481348

13491349
if ((cc == IPMI_DEVICE_IN_FW_UPDATE_ERR
13501350
|| cc == IPMI_DEVICE_IN_INIT_ERR

0 commit comments

Comments
 (0)