Re: [PATCH] ipmi: ssif_bmc: Uninitialized return in ssif_bmc_write()

Corey Minyard
2021-07-30T23:22:42Z

On Fri, Jul 30, 2021 at 06:08:01PM +0300, Dan Carpenter wrote:
> I accidentally introduced a bug in my previous patch. The "ret"
> variable needs to be initialized to prevent returning uninitialized
> data.

Thanks Dan, it's queued.

-corey

>
> Fixes: f9714eb04364 ("ipmi: ssif_bmc: Return -EFAULT if copy_from_user() fails")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Sorry!
>
> drivers/char/ipmi/ssif_bmc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/char/ipmi/ssif_bmc.c b/drivers/char/ipmi/ssif_bmc.c
> index ce8cd8364a3f..acdb1d9cb5c0 100644
> --- a/drivers/char/ipmi/ssif_bmc.c
> +++ b/drivers/char/ipmi/ssif_bmc.c
> @@ -80,7 +80,7 @@ static ssize_t ssif_bmc_write(struct file *file, const char __user *buf, size_t
> struct ssif_bmc_ctx *ssif_bmc = to_ssif_bmc(file);
> struct ssif_msg msg;
> unsigned long flags;
> - ssize_t ret;
> + ssize_t ret = 0;
>
> if (count > sizeof(struct ssif_msg))
> return -EINVAL;
> --
> 2.20.1
>