summaryrefslogtreecommitdiff
path: root/drivers/infiniband/sw/rxe/rxe_mr.c
diff options
context:
space:
mode:
authorDoug Ledford <dledford@redhat.com>2017-02-19 09:18:21 -0500
committerDoug Ledford <dledford@redhat.com>2017-02-19 09:18:21 -0500
commit6dd7abae7110da6fa01f048baf5b679b5a4a56dd (patch)
tree17ca298bbae17f05bdadae7f88e3be0f113a713f /drivers/infiniband/sw/rxe/rxe_mr.c
parent6df6b4a9ce43deb57d3e23b0e79a529464b5cf37 (diff)
parent646ebd4166ca00bdf682a36bd2e1c9a74d848ac6 (diff)
downloadlwn-6dd7abae7110da6fa01f048baf5b679b5a4a56dd.tar.gz
lwn-6dd7abae7110da6fa01f048baf5b679b5a4a56dd.zip
Merge branch 'k.o/for-4.10-rc' into HEAD
Diffstat (limited to 'drivers/infiniband/sw/rxe/rxe_mr.c')
-rw-r--r--drivers/infiniband/sw/rxe/rxe_mr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
index 8cf38b253c37..37eea7441ca4 100644
--- a/drivers/infiniband/sw/rxe/rxe_mr.c
+++ b/drivers/infiniband/sw/rxe/rxe_mr.c
@@ -59,9 +59,11 @@ int mem_check_range(struct rxe_mem *mem, u64 iova, size_t length)
case RXE_MEM_TYPE_MR:
case RXE_MEM_TYPE_FMR:
- return ((iova < mem->iova) ||
- ((iova + length) > (mem->iova + mem->length))) ?
- -EFAULT : 0;
+ if (iova < mem->iova ||
+ length > mem->length ||
+ iova > mem->iova + mem->length - length)
+ return -EFAULT;
+ return 0;
default:
return -EFAULT;