Skip to content

Commit 1d48405

Browse files
Alexey Nepomnyashihgregkh
authored andcommitted
net: liquidio: fix overflow in octeon_init_instr_queue()
[ Upstream commit cca7b1c ] 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 <sdl@nppct.ru> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e71dae1 commit 1d48405

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
@@ -135,7 +135,7 @@ int octeon_init_instr_queue(struct octeon_device *oct,
135135
oct->io_qmask.iq |= BIT_ULL(iq_no);
136136

137137
/* Set the 32B/64B mode for each input queue */
138-
oct->io_qmask.iq64B |= ((conf->instr_type == 64) << iq_no);
138+
oct->io_qmask.iq64B |= ((u64)(conf->instr_type == 64) << iq_no);
139139
iq->iqcmd_64B = (conf->instr_type == 64);
140140

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

0 commit comments

Comments
 (0)