Skip to content

Commit ccc495e

Browse files
Dan Carpentermartinkpetersen
authored andcommitted
scsi: cxgb4i: silence overflow warning in t4_uld_rx_handler()
Smatch marks skb->data as untrusted so it complains that there is a potential overflow here: drivers/scsi/cxgbi/cxgb4i/cxgb4i.c:2111 t4_uld_rx_handler() error: buffer overflow 'cxgb4i_cplhandlers' 239 <= 255. In this case, skb->data comes from the hardware or firmware so it's not going to overflow unless there is a firmware bug. [mkp: fixed braces] Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 7709e9b commit ccc495e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/scsi/cxgbi/cxgb4i/cxgb4i.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,12 +2108,12 @@ static int t4_uld_rx_handler(void *handle, const __be64 *rsp,
21082108
log_debug(1 << CXGBI_DBG_TOE,
21092109
"cdev %p, opcode 0x%x(0x%x,0x%x), skb %p.\n",
21102110
cdev, opc, rpl->ot.opcode_tid, ntohl(rpl->ot.opcode_tid), skb);
2111-
if (cxgb4i_cplhandlers[opc])
2112-
cxgb4i_cplhandlers[opc](cdev, skb);
2113-
else {
2111+
if (opc >= ARRAY_SIZE(cxgb4i_cplhandlers) || !cxgb4i_cplhandlers[opc]) {
21142112
pr_err("No handler for opcode 0x%x.\n", opc);
21152113
__kfree_skb(skb);
2116-
}
2114+
} else
2115+
cxgb4i_cplhandlers[opc](cdev, skb);
2116+
21172117
return 0;
21182118
nomem:
21192119
log_debug(1 << CXGBI_DBG_TOE, "OOM bailing out.\n");

0 commit comments

Comments
 (0)