diff mbox

qla2xxx UBSAN warning in 4.14-rc1

Message ID alpine.LRH.2.21.1801250012070.28967@math.ut.ee (mailing list archive)
State Superseded
Headers show

Commit Message

Meelis Roos Jan. 24, 2018, 10:18 p.m. UTC
> > Hello, I decided to widen the coverage of my kernel testbed and put some 
> > FC cards into servers. This one is a PCI-X QLA2340 in HP Proliant DL 380 
> > G4 (first 64-bit generation of Proliants). I got a UBSAN warning from 
> > qla2xxx before probing for the firmware.
> 
> Would it be possible for you to test the (completely untested) patch below?

It compiles without warnings and the driver loads without warnings.

Meanwhile I tried the following patch, also successfully.

However, the same problem is present in qla24xx_mbx_completion (and can 
also be trivially patched over).

I did not understand the logic of what's goind on with mailboxes - there 
seem to be up to 32 of them and for some reason, a bitmask is used for 
iterating over them, with mboxes = ha->mcp->in_mb filtering out some 
mailboxes, and in_mb bitmap value comes from firmware?
diff mbox

Patch

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 2fd79129bb2a..7868930ae1c8 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -272,7 +272,7 @@  qla2x00_mbx_completion(scsi_qla_host_t *vha, uint16_t mb0)
 	struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
 
 	/* Read all mbox registers? */
-	mboxes = (1 << ha->mbx_count) - 1;
+	mboxes = (1ULL << ha->mbx_count) - 1;
 	if (!ha->mcp)
 		ql_dbg(ql_dbg_async, vha, 0x5001, "MBX pointer ERROR.\n");
 	else