* [PATCH] cxl/mbox: Replace NULL check with IS_ERR() after vmemdup_user()
@ 2022-04-07 1:09 alison.schofield
2022-04-12 16:39 ` Ira Weiny
0 siblings, 1 reply; 2+ messages in thread
From: alison.schofield @ 2022-04-07 1:09 UTC (permalink / raw)
To: Ben Widawsky, Dan Williams, Ira Weiny, Vishal Verma
Cc: Alison Schofield, linux-cxl, kernel test robot, Dan Carpenter
From: Alison Schofield <alison.schofield@intel.com>
vmemdup_user() returns an ERR_PTR() on failure. Use IS_ERR()
to check the return value.
Fixes: be0d0ce77aa3 ("cxl/mbox: Move build of user mailbox cmd to a helper funct
ions")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
drivers/cxl/core/mbox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index 8a8388599a85..2449878d4b4b 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -263,7 +263,7 @@ static int cxl_mbox_cmd_ctor(struct cxl_mbox_cmd *mbox,
if (in_size) {
mbox->payload_in = vmemdup_user(u64_to_user_ptr(in_payload),
in_size);
- if (!mbox->payload_in)
+ if (IS_ERR(mbox->payload_in))
return PTR_ERR(mbox->payload_in);
if (!cxl_payload_from_user_allowed(opcode, mbox->payload_in)) {
base-commit: 7dc1d11d7abae52aada5340fb98885f0ddbb7c37
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] cxl/mbox: Replace NULL check with IS_ERR() after vmemdup_user()
2022-04-07 1:09 [PATCH] cxl/mbox: Replace NULL check with IS_ERR() after vmemdup_user() alison.schofield
@ 2022-04-12 16:39 ` Ira Weiny
0 siblings, 0 replies; 2+ messages in thread
From: Ira Weiny @ 2022-04-12 16:39 UTC (permalink / raw)
To: alison.schofield
Cc: Ben Widawsky, Dan Williams, Vishal Verma, linux-cxl,
kernel test robot, Dan Carpenter
On Wed, Apr 06, 2022 at 06:09:15PM -0700, Alison Schofield wrote:
> From: Alison Schofield <alison.schofield@intel.com>
>
> vmemdup_user() returns an ERR_PTR() on failure. Use IS_ERR()
> to check the return value.
>
> Fixes: be0d0ce77aa3 ("cxl/mbox: Move build of user mailbox cmd to a helper funct
> ions")
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> ---
> drivers/cxl/core/mbox.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index 8a8388599a85..2449878d4b4b 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -263,7 +263,7 @@ static int cxl_mbox_cmd_ctor(struct cxl_mbox_cmd *mbox,
> if (in_size) {
> mbox->payload_in = vmemdup_user(u64_to_user_ptr(in_payload),
> in_size);
> - if (!mbox->payload_in)
> + if (IS_ERR(mbox->payload_in))
> return PTR_ERR(mbox->payload_in);
>
> if (!cxl_payload_from_user_allowed(opcode, mbox->payload_in)) {
>
> base-commit: 7dc1d11d7abae52aada5340fb98885f0ddbb7c37
> --
> 2.31.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-12 16:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-07 1:09 [PATCH] cxl/mbox: Replace NULL check with IS_ERR() after vmemdup_user() alison.schofield
2022-04-12 16:39 ` Ira Weiny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox