Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ntb: use 64-bit arithmetic for the MSI doorbell mask

msi_db_mask is of type 'u64', still the standard 'int' arithmetic is
performed to compute its value.

While most of the ntb_hw drivers actually don't utilize the higher 32
bits of the doorbell mask now, this may be the case for Switchtec - see
switchtec_ntb_init_db().

Found by Linux Verification Center (linuxtesting.org) with SVACE static
analysis tool.

Fixes: 2b0569b3b7e6 ("NTB: Add MSI interrupt support to ntb_transport")
Cc: stable@vger.kernel.org
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>

authored by

Fedor Pchelkin and committed by
Jon Mason
fd5625fc 1991934c

+1 -1
+1 -1
drivers/ntb/ntb_transport.c
··· 1353 1353 qp_count = ilog2(qp_bitmap); 1354 1354 if (nt->use_msi) { 1355 1355 qp_count -= 1; 1356 - nt->msi_db_mask = 1 << qp_count; 1356 + nt->msi_db_mask = BIT_ULL(qp_count); 1357 1357 ntb_db_clear_mask(ndev, nt->msi_db_mask); 1358 1358 } 1359 1359