public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH v2] hwmon: (nct7802) Fix overflows seen when writing into limit attributes
Date: Mon, 12 Dec 2016 16:43:22 +0100	[thread overview]
Message-ID: <20161212164322.0449bec2@endymion> (raw)
In-Reply-To: <73ac82c8-8fc3-0def-aa5d-0bcab714cc4b@roeck-us.net>

On Mon, 12 Dec 2016 06:14:14 -0800, Guenter Roeck wrote:
> Hi Jean,
> 
> On 12/12/2016 02:03 AM, Jean Delvare wrote:
> > On Fri,  9 Dec 2016 12:41:02 -0800, Guenter Roeck wrote:
> >> Fix overflows seen when writing voltage and temperature limit attributes.
> >>
> >> The value passed to DIV_ROUND_CLOSEST() needs to be clamped, and the
> >> value parameter passed to nct7802_write_fan_min() is an unsigned long.
> >>
> >> Also, writing values larger than 2700000 into a limit attribute results
> >> in writing 0 into the chip's limit registers.
> >
> > You are only talking about _fan_ limits, right?
> >
> Yes. I'll clarify.
> 
> >> The exact behavior when
> >> writing this value is unspecified. For consistency, report a limit of
> >> 1350000 if the chip register reads 0.  This may be wrong, and the chip
> >> behavior should be verified with the actual chip, but it is better than
> >> reporting a value of 0 (which, if written, results in writing a value
> >> of 0x1fff into the chip register).
> >
> > This fix is good by doesn't seem to be related with the overflows?
> >
> Writing a limit larger than 2700000 results in writing 0 into the register,
> which is reported back as 0. 2699999 -> 1 -> 1350000, 2700000 -> 0 -> 0.
> I consider that an overflow situation.

OK, I understand, you are right.

-- 
Jean Delvare
SUSE L3 Support

      reply	other threads:[~2016-12-12 15:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09 20:41 [PATCH v2] hwmon: (nct7802) Fix overflows seen when writing into limit attributes Guenter Roeck
2016-12-12 10:03 ` Jean Delvare
2016-12-12 14:14   ` Guenter Roeck
2016-12-12 15:43     ` Jean Delvare [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=20161212164322.0449bec2@endymion \
    --to=jdelvare@suse.de \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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