From: Wei Yongjun <weiyongjun1@huawei.com>
To: Frederic Barrat <fbarrat@linux.ibm.com>,
Andrew Donnellan <ajd@linux.ibm.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alastair D'Silva <alastair@d-silva.org>
Cc: linuxppc-dev@lists.ozlabs.org, kernel-janitors@vger.kernel.org,
Wei Yongjun <weiyongjun1@huawei.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH -next] ocxl: Fix return value check in afu_ioctl()
Date: Sat, 04 May 2019 06:55:00 +0000 [thread overview]
Message-ID: <20190504070430.57008-1-weiyongjun1@huawei.com> (raw)
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>
---
drivers/misc/ocxl/file.c | 4 ++--
1 file 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;
next reply other threads:[~2019-05-04 6:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-04 6:55 Wei Yongjun [this message]
2019-05-05 4:46 ` [PATCH -next] ocxl: Fix return value check in afu_ioctl() Alastair D'Silva
2019-05-05 14:22 ` Andrew Donnellan
2019-05-06 13:54 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190504070430.57008-1-weiyongjun1@huawei.com \
--to=weiyongjun1@huawei.com \
--cc=ajd@linux.ibm.com \
--cc=alastair@d-silva.org \
--cc=arnd@arndb.de \
--cc=fbarrat@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox