* [PATCH -next] ocxl: Fix return value check in afu_ioctl()
@ 2019-05-04 7:04 Wei Yongjun
2019-05-05 4:46 ` Alastair D'Silva
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Wei Yongjun @ 2019-05-04 7:04 UTC (permalink / raw)
To: Frederic Barrat, Andrew Donnellan, Arnd Bergmann,
Greg Kroah-Hartman, Alastair D'Silva
Cc: linuxppc-dev, kernel-janitors, Wei Yongjun, linux-kernel
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;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH -next] ocxl: Fix return value check in afu_ioctl()
2019-05-04 7:04 [PATCH -next] ocxl: Fix return value check in afu_ioctl() Wei Yongjun
@ 2019-05-05 4:46 ` Alastair D'Silva
2019-05-05 14:22 ` Andrew Donnellan
2019-05-06 13:54 ` Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: Alastair D'Silva @ 2019-05-05 4:46 UTC (permalink / raw)
To: 'Wei Yongjun', 'Frederic Barrat',
'Andrew Donnellan', 'Arnd Bergmann',
'Greg Kroah-Hartman'
Cc: kernel-janitors, linuxppc-dev, linux-kernel
> -----Original Message-----
> From: Wei Yongjun <weiyongjun1@huawei.com>
> Sent: Saturday, 4 May 2019 5:05 PM
> 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: Wei Yongjun <weiyongjun1@huawei.com>; linuxppc-
> dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; kernel-
> janitors@vger.kernel.org
> Subject: [PATCH -next] 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>
> ---
> 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;
LGTM
Acked-by: Alastair D'Silva <alastair@d-silva.org>
--
Alastair D'Silva mob: 0423 762 819
skype: alastair_dsilva msn: alastair@d-silva.org
blog: http://alastair.d-silva.org Twitter: @EvilDeece
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] ocxl: Fix return value check in afu_ioctl()
2019-05-04 7:04 [PATCH -next] ocxl: Fix return value check in afu_ioctl() Wei Yongjun
2019-05-05 4:46 ` Alastair D'Silva
@ 2019-05-05 14:22 ` Andrew Donnellan
2019-05-06 13:54 ` Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: Andrew Donnellan @ 2019-05-05 14:22 UTC (permalink / raw)
To: Wei Yongjun, Frederic Barrat, Arnd Bergmann, Greg Kroah-Hartman,
Alastair D'Silva
Cc: kernel-janitors, linuxppc-dev, linux-kernel
On 4/5/19 5:04 pm, Wei Yongjun wrote:
> 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: Andrew Donnellan <ajd@linux.ibm.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;
>
>
>
--
Andrew Donnellan OzLabs, ADL Canberra
ajd@linux.ibm.com IBM Australia Limited
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] ocxl: Fix return value check in afu_ioctl()
2019-05-04 7:04 [PATCH -next] ocxl: Fix return value check in afu_ioctl() Wei Yongjun
2019-05-05 4:46 ` Alastair D'Silva
2019-05-05 14:22 ` Andrew Donnellan
@ 2019-05-06 13:54 ` Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2019-05-06 13:54 UTC (permalink / raw)
To: Wei Yongjun, Frederic Barrat, Andrew Donnellan, Arnd Bergmann,
Greg Kroah-Hartman, Alastair D'Silva
Cc: kernel-janitors, linuxppc-dev, linux-kernel, Wei Yongjun
On Sat, 2019-05-04 at 07:04:30 UTC, Wei Yongjun wrote:
> 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>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/6be6a8de1b55e719e3f9589491074371
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-06 13:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-04 7:04 [PATCH -next] ocxl: Fix return value check in afu_ioctl() Wei Yongjun
2019-05-05 4:46 ` Alastair D'Silva
2019-05-05 14:22 ` Andrew Donnellan
2019-05-06 13:54 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).