IB/hfi1: Fix math bugs in hfi1_can_pin_pages()
authorPatrick Kelsey <pat.kelsey@cornelisnetworks.com>
Thu, 16 Feb 2023 16:56:23 +0000 (11:56 -0500)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 17 Feb 2023 20:38:26 +0000 (16:38 -0400)
commita0d198f79a8d033bd46605b779859193649f1f99
treee8277b1dc085a330a0cb61ba5bb2679b8e094527
parentd2225b838ccad126045e048471441693c7bca217
IB/hfi1: Fix math bugs in hfi1_can_pin_pages()

Fix arithmetic and logic errors in hfi1_can_pin_pages() that  would allow
hfi1 to attempt pinning pages in cases where it should not because of
resource limits or lack of required capability.

Fixes: 2c97ce4f3c29 ("IB/hfi1: Add pin query function")
Link: https://lore.kernel.org/r/167656658362.2223096.10954762619837718026.stgit@awfm-02.cornelisnetworks.com
Signed-off-by: Brendan Cunningham <bcunningham@cornelisnetworks.com>
Signed-off-by: Patrick Kelsey <pat.kelsey@cornelisnetworks.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hfi1/user_pages.c