From: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
To: andrew.donnellan@au1.ibm.com, linuxppc-dev@lists.ozlabs.org
Cc: dan.carpenter@oracle.com
Subject: [PATCH] ocxl: Fix potential bad errno on irq allocation
Date: Fri, 16 Feb 2018 14:01:18 +0100 [thread overview]
Message-ID: <20180216130118.26008-1-fbarrat@linux.vnet.ibm.com> (raw)
Fix some issues found by a static checker:
When allocating an AFU interrupt, if the driver cannot copy the output
parameters to userland, the errno value was not set to EFAULT
Remove a (now) useless cast.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
---
drivers/misc/ocxl/file.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
index 2dd2db9bc1c9..337462e1569f 100644
--- a/drivers/misc/ocxl/file.c
+++ b/drivers/misc/ocxl/file.c
@@ -133,8 +133,10 @@ static long afu_ioctl(struct file *file, unsigned int cmd,
if (!rc) {
rc = copy_to_user((u64 __user *) args, &irq_offset,
sizeof(irq_offset));
- if (rc)
+ if (rc) {
ocxl_afu_irq_free(ctx, irq_offset);
+ return -EFAULT;
+ }
}
break;
@@ -329,7 +331,7 @@ static ssize_t afu_read(struct file *file, char __user *buf, size_t count,
used += sizeof(header);
- rc = (ssize_t) used;
+ rc = used;
return rc;
}
--
2.14.1
next reply other threads:[~2018-02-16 13:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-16 13:01 Frederic Barrat [this message]
2018-02-20 23:21 ` [PATCH] ocxl: Fix potential bad errno on irq allocation Andrew Donnellan
2018-02-21 13:43 ` 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=20180216130118.26008-1-fbarrat@linux.vnet.ibm.com \
--to=fbarrat@linux.vnet.ibm.com \
--cc=andrew.donnellan@au1.ibm.com \
--cc=dan.carpenter@oracle.com \
--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;
as well as URLs for NNTP newsgroup(s).