Skip to content

Commit cca7b1c

Browse files
Alexey Nepomnyashihkuba-moo
authored andcommitted
net: liquidio: fix overflow in octeon_init_instr_queue()
The expression `(conf->instr_type == 64) << iq_no` can overflow because `iq_no` may be as high as 64 (`CN23XX_MAX_RINGS_PER_PF`). Casting the operand to `u64` ensures correct 64-bit arithmetic. Fixes: f21fb3e ("Add support of Cavium Liquidio ethernet adapters") Signed-off-by: Alexey Nepomnyashih <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 87ebb62 commit cca7b1c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/cavium/liquidio/request_manager.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ int octeon_init_instr_queue(struct octeon_device *oct,
126126
oct->io_qmask.iq |= BIT_ULL(iq_no);
127127

128128
/* Set the 32B/64B mode for each input queue */
129-
oct->io_qmask.iq64B |= ((conf->instr_type == 64) << iq_no);
129+
oct->io_qmask.iq64B |= ((u64)(conf->instr_type == 64) << iq_no);
130130
iq->iqcmd_64B = (conf->instr_type == 64);
131131

132132
oct->fn_list.setup_iq_regs(oct, iq_no);

0 commit comments

Comments
 (0)