summaryrefslogtreecommitdiffstats
path: root/drivers/ntb/hw
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2019-03-25 12:17:26 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-27 14:50:55 +0100
commiteddad30e746165fa951e056bbc6b02cd9e50623e (patch)
tree5311fffe874b8df4065f3973f5c945eb6c703e2b /drivers/ntb/hw
parent9a0e3a1d2ab6e6d5776e50b8408a80bd076e9ec0 (diff)
downloadlinux-stable-eddad30e746165fa951e056bbc6b02cd9e50623e.tar.gz
linux-stable-eddad30e746165fa951e056bbc6b02cd9e50623e.tar.bz2
linux-stable-eddad30e746165fa951e056bbc6b02cd9e50623e.zip
ntb_hw_switchtec: potential shift wrapping bug in switchtec_ntb_init_sndev()
[ Upstream commit ff148d8ac53e59802645bd3200c811620317eb9f ] This code triggers a Smatch warning: drivers/ntb/hw/mscc/ntb_hw_switchtec.c:884 switchtec_ntb_init_sndev() warn: should '(1 << sndev->peer_partition)' be a 64 bit type? The "part_map" and "tpart_vec" variables are u64 type so this seems like a valid warning. Fixes: 3df54c870f52 ("ntb_hw_switchtec: Allow using Switchtec NTB in multi-partition setups") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Jon Mason <jdmason@kudzu.us> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/ntb/hw')
-rw-r--r--drivers/ntb/hw/mscc/ntb_hw_switchtec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
index 9916bc5b6759..313f6258c424 100644
--- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
+++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
@@ -899,7 +899,7 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev)
}
sndev->peer_partition = ffs(tpart_vec) - 1;
- if (!(part_map & (1 << sndev->peer_partition))) {
+ if (!(part_map & (1ULL << sndev->peer_partition))) {
dev_err(&sndev->stdev->dev,
"ntb target partition is not NT partition\n");
return -ENODEV;