ntb_hw_switchtec: potential shift wrapping bug in switchtec_ntb_init_sndev()
Subsystems (4)
PATCH 1/1 ntb_hw_switchtec: potential shift wrapping bug in switchtec_ntb_init_sndev()
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 <[email protected]>
--- drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/hw/mscc/ntb_hw_switchtec.c +1 -1
@@ -881,7 +881,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 ;
Signature · 1 line
2.17.1
Thanks!
Quoted 10 lines · Dan Carpenter
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 <[email protected]>
Reviewed-by Logan Gunthorpe <[email protected]>
Jon Mason
maintainerQuoted 8 lines · Logan Gunthorpe
Thanks!
Quoted 5 lines · Dan Carpenter
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?
Quoted 7 lines
Quoted 5 lines
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 <[email protected]>Reviewed-by Logan Gunthorpe <[email protected]>
Sorry for the delay. The patch is now in the ntb branch. We've missed window for 5.2, but it will be in the 5.3 pull request.
Thanks,
Jon
Quoted 7 lines
Signature · 6 lines
-- You received this message because you are subscribed to the Google Groups "linux-ntb" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/linux-ntb/e2bc8cf0-8e3e-9335-e21b-4a9697e9c0ef%40deltatee.com. For more options, visit https://groups.google.com/d/optout.