Commit cca7b1cf authored by Alexey Nepomnyashih's avatar Alexey Nepomnyashih Committed by Jakub Kicinski
Browse files

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: f21fb3ed ("Add support of Cavium Liquidio ethernet adapters")
Signed-off-by: default avatarAlexey Nepomnyashih <sdl@nppct.ru>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 87ebb628
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ int octeon_init_instr_queue(struct octeon_device *oct,
	oct->io_qmask.iq |= BIT_ULL(iq_no);

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

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