public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Eddie James <eajames@linux.ibm.com>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
	jdelvare@suse.com, dan.carpenter@oracle.com
Subject: Re: [PATCH] hwmon: (pmbus/ibm-cffps) Prevent writing on_off_config with bad data
Date: Fri, 10 Jan 2020 19:45:41 -0800	[thread overview]
Message-ID: <20200111034541.GA5609@roeck-us.net> (raw)
In-Reply-To: <1578411640-16929-1-git-send-email-eajames@linux.ibm.com>

On Tue, Jan 07, 2020 at 09:40:40AM -0600, Eddie James wrote:
> If the user write parameters resulted in no bytes being written to the
> temporary buffer, then ON_OFF_CONFIG will be written with uninitialized
> data. Prevent this by bailing out in this case.
> 
> Signed-off-by: Eddie James <eajames@linux.ibm.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/pmbus/ibm-cffps.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c
> index 1c91ee1f9926..3795fe55b84f 100644
> --- a/drivers/hwmon/pmbus/ibm-cffps.c
> +++ b/drivers/hwmon/pmbus/ibm-cffps.c
> @@ -250,7 +250,7 @@ static ssize_t ibm_cffps_debugfs_write(struct file *file,
>  		pmbus_set_page(psu->client, 0);
>  
>  		rc = simple_write_to_buffer(&data, 1, ppos, buf, count);
> -		if (rc < 0)
> +		if (rc <= 0)
>  			return rc;
>  
>  		rc = i2c_smbus_write_byte_data(psu->client,

      reply	other threads:[~2020-01-11  3:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 15:40 [PATCH] hwmon: (pmbus/ibm-cffps) Prevent writing on_off_config with bad data Eddie James
2020-01-11  3:45 ` Guenter Roeck [this message]

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=20200111034541.GA5609@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=dan.carpenter@oracle.com \
    --cc=eajames@linux.ibm.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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