Commit c011410d authored by Dan Carpenter's avatar Dan Carpenter Committed by Corey Minyard
Browse files

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: f8910ffa ("ipmi:msghandler: retry to get device id on an error")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Message-Id: <20200918142756.GB909725@mwanda>
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
parent 42d8a346
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -319,7 +319,7 @@ struct bmc_device {
	int                    dyn_guid_set;
	struct kref	       usecount;
	struct work_struct     remove_work;
	char		       cc; /* completion code */
	unsigned char	       cc; /* completion code */
};
#define to_bmc_device(x) container_of((x), struct bmc_device, pdev.dev)

+1 −1
Original line number Diff line number Diff line
@@ -1344,7 +1344,7 @@ retry:
			resp + 2, resp_len - 2, &smi_info->device_id);
	if (rv) {
		/* record completion code */
		char cc = *(resp + 2);
		unsigned char cc = *(resp + 2);

		if ((cc == IPMI_DEVICE_IN_FW_UPDATE_ERR
		    || cc == IPMI_DEVICE_IN_INIT_ERR