* [PATCH] ipmi: ssif_bmc: Return -EFAULT if copy_from_user() fails
@ 2021-07-23 8:44 Dan Carpenter
2021-07-23 12:24 ` Corey Minyard
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-07-23 8:44 UTC (permalink / raw)
To: Corey Minyard
Cc: Quan Nguyen, openipmi-developer, linux-kernel, kernel-janitors
The copy_from_user() function returns the number of bytes remaining to
be copied but we should return -EFAULT here.
Fixes: 007888f365c9 ("ipmi: ssif_bmc: Add SSIF BMC driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/char/ipmi/ssif_bmc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/char/ipmi/ssif_bmc.c b/drivers/char/ipmi/ssif_bmc.c
index b15c05622e72..ce8cd8364a3f 100644
--- a/drivers/char/ipmi/ssif_bmc.c
+++ b/drivers/char/ipmi/ssif_bmc.c
@@ -85,9 +85,8 @@ static ssize_t ssif_bmc_write(struct file *file, const char __user *buf, size_t
if (count > sizeof(struct ssif_msg))
return -EINVAL;
- ret = copy_from_user(&msg, buf, count);
- if (ret)
- return ret;
+ if (copy_from_user(&msg, buf, count))
+ return -EFAULT;
if (!msg.len || count < ssif_msg_len(&msg))
return -EINVAL;
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ipmi: ssif_bmc: Return -EFAULT if copy_from_user() fails
2021-07-23 8:44 [PATCH] ipmi: ssif_bmc: Return -EFAULT if copy_from_user() fails Dan Carpenter
@ 2021-07-23 12:24 ` Corey Minyard
0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2021-07-23 12:24 UTC (permalink / raw)
To: Dan Carpenter
Cc: Quan Nguyen, openipmi-developer, linux-kernel, kernel-janitors
On Fri, Jul 23, 2021 at 11:44:59AM +0300, Dan Carpenter wrote:
> The copy_from_user() function returns the number of bytes remaining to
> be copied but we should return -EFAULT here.
Yep, this is in my queue.
Thanks,
-corey
>
> Fixes: 007888f365c9 ("ipmi: ssif_bmc: Add SSIF BMC driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/char/ipmi/ssif_bmc.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/char/ipmi/ssif_bmc.c b/drivers/char/ipmi/ssif_bmc.c
> index b15c05622e72..ce8cd8364a3f 100644
> --- a/drivers/char/ipmi/ssif_bmc.c
> +++ b/drivers/char/ipmi/ssif_bmc.c
> @@ -85,9 +85,8 @@ static ssize_t ssif_bmc_write(struct file *file, const char __user *buf, size_t
> if (count > sizeof(struct ssif_msg))
> return -EINVAL;
>
> - ret = copy_from_user(&msg, buf, count);
> - if (ret)
> - return ret;
> + if (copy_from_user(&msg, buf, count))
> + return -EFAULT;
>
> if (!msg.len || count < ssif_msg_len(&msg))
> return -EINVAL;
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-23 12:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23 8:44 [PATCH] ipmi: ssif_bmc: Return -EFAULT if copy_from_user() fails Dan Carpenter
2021-07-23 12:24 ` Corey Minyard
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).