cxl/mbox: Replace NULL check with IS_ERR() after vmemdup_user()
[email protected]
maintainerPATCH 1/1 cxl/mbox: Replace NULL check with IS_ERR() after vmemdup_user()
From: Alison Schofield <[email protected]>
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 <[email protected]>
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Alison Schofield <[email protected]>
--- drivers/cxl/core/mbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/core/mbox.c +1 -1
@@ -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
Signature · 1 line
2.31.1
Quoted 10 lines · Alison Schofield
From: Alison Schofield <[email protected]>
vmemdup_user()returns anERR_PTR()on failure. UseIS_ERR()to check the return value.Fixes be0d0ce77aa3 ("cxl/mbox: Move build of user mailbox cmd to a helper functions")
Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Alison Schofield <[email protected]>
Reviewed-by Ira Weiny <[email protected]>
Quoted 22 lines
--- drivers/cxl/core/mbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cxl/core/mbox.c +1
-1@@ -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:
7dc1d11d7abae52aada5340fb98885f0ddbb7c37Signature · 1 line
2.31.1