summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2019-03-25 10:23:26 +0100
committerJon Mason <jdmason@kudzu.us>2019-06-13 14:59:18 +0200
commit1e590dec3ed6852dba6fcbcc7e5300c893914fd7 (patch)
tree28cbc05fd2c898cb8aca4d9891acd549233825e4
parentntb_hw_switchtec: potential shift wrapping bug in switchtec_ntb_init_sndev() (diff)
downloadlinux-1e590dec3ed6852dba6fcbcc7e5300c893914fd7.tar.xz
linux-1e590dec3ed6852dba6fcbcc7e5300c893914fd7.zip
NTB: amd: Silence shift wrapping warning in amd_ntb_db_vector_mask()
This code triggers a Smatch warning: drivers/ntb/hw/amd/ntb_hw_amd.c:336 amd_ntb_db_vector_mask() warn: should '(1 << db_vector)' be a 64 bit type? I don't think "db_vector" can be higher than 16 so this doesn't affect runtime, but it's nice to silence the static checker warning and we might increase "ndev->db_count" in the future. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Signed-off-by: Jon Mason <jdmason@kudzu.us>
-rw-r--r--drivers/ntb/hw/amd/ntb_hw_amd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c
index cd463e132035..2859cc99b73e 100644
--- a/drivers/ntb/hw/amd/ntb_hw_amd.c
+++ b/drivers/ntb/hw/amd/ntb_hw_amd.c
@@ -333,7 +333,7 @@ static u64 amd_ntb_db_vector_mask(struct ntb_dev *ntb, int db_vector)
if (db_vector < 0 || db_vector > ndev->db_count)
return 0;
- return ntb_ndev(ntb)->db_valid_mask & (1 << db_vector);
+ return ntb_ndev(ntb)->db_valid_mask & (1ULL << db_vector);
}
static u64 amd_ntb_db_read(struct ntb_dev *ntb)