]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ntb: use 64-bit arithmetic for the MSI doorbell mask
authorFedor Pchelkin <pchelkin@ispras.ru>
Wed, 15 Jan 2025 18:28:17 +0000 (21:28 +0300)
committerJon Mason <jdmason@kudzu.us>
Tue, 18 Mar 2025 14:34:47 +0000 (10:34 -0400)
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>
drivers/ntb/ntb_transport.c

index a22ea4a4b202bd63fe5e027a69d540551e15a80a..4f775c3e218f45c35e7ee1ad198da7ef70eade52 100644 (file)
@@ -1353,7 +1353,7 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev)
        qp_count = ilog2(qp_bitmap);
        if (nt->use_msi) {
                qp_count -= 1;
-               nt->msi_db_mask = 1 << qp_count;
+               nt->msi_db_mask = BIT_ULL(qp_count);
                ntb_db_clear_mask(ndev, nt->msi_db_mask);
        }