summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2019-05-04 09:04:30 +0200
committerMichael Ellerman <mpe@ellerman.id.au>2019-05-06 12:21:56 +0200
commit6be6a8de1b55e719e3f95894910743719065d6a1 (patch)
tree89a12e24df0c9ee8acf975288c0c7800a97d67bb /drivers/misc
parentpowerpc/mm: fix section mismatch for setup_kup() (diff)
downloadlinux-6be6a8de1b55e719e3f95894910743719065d6a1.tar.xz
linux-6be6a8de1b55e719e3f95894910743719065d6a1.zip
ocxl: Fix return value check in afu_ioctl()
In case of error, the function eventfd_ctx_fdget() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). This issue was detected by using the Coccinelle software. Fixes: 060146614643 ("ocxl: move event_fd handling to frontend") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Acked-by: Alastair D'Silva <alastair@d-silva.org> Acked-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/ocxl/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
index 8aa22893ed76..2870c25da166 100644
--- a/drivers/misc/ocxl/file.c
+++ b/drivers/misc/ocxl/file.c
@@ -257,8 +257,8 @@ static long afu_ioctl(struct file *file, unsigned int cmd,
return -EINVAL;
irq_id = ocxl_irq_offset_to_id(ctx, irq_fd.irq_offset);
ev_ctx = eventfd_ctx_fdget(irq_fd.eventfd);
- if (!ev_ctx)
- return -EFAULT;
+ if (IS_ERR(ev_ctx))
+ return PTR_ERR(ev_ctx);
rc = ocxl_irq_set_handler(ctx, irq_id, irq_handler, irq_free, ev_ctx);
break;