lkml.org 
[lkml]   [2020]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] RDMA/rxe: check for error
Date
rxe_create_mmap_info() returns either NULL or an error value in ERR_PTR
and we only checked for NULL after return. We should be using
IS_ERR_OR_NULL to check for both.

Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
drivers/infiniband/sw/rxe/rxe_queue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_queue.c b/drivers/infiniband/sw/rxe/rxe_queue.c
index ff92704de32f..ef438ce4fcfa 100644
--- a/drivers/infiniband/sw/rxe/rxe_queue.c
+++ b/drivers/infiniband/sw/rxe/rxe_queue.c
@@ -45,7 +45,7 @@ int do_mmap_info(struct rxe_dev *rxe, struct mminfo __user *outbuf,

if (outbuf) {
ip = rxe_create_mmap_info(rxe, buf_size, udata, buf);
- if (!ip)
+ if (IS_ERR_OR_NULL(ip))
goto err1;

err = copy_to_user(outbuf, &ip->info, sizeof(ip->info));
--
2.11.0
\
 
 \ /
  Last update: 2020-04-23 12:49    [W:0.068 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site