All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <guenter.roeck@ericsson.com>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH 79/79] hwmon: (it87) Fix vrm value range
Date: Tue, 24 Jan 2012 15:11:27 +0000	[thread overview]
Message-ID: <20120124151127.GA23472@ericsson.com> (raw)
In-Reply-To: <1327373398-997-80-git-send-email-guenter.roeck@ericsson.com>

On Tue, Jan 24, 2012 at 03:50:12AM -0500, Jean Delvare wrote:
> Hi Guenter,
> 
> On Mon, 23 Jan 2012 18:49:58 -0800, Guenter Roeck wrote:
> > When updating vrm, the value range was not limited. This could result in more or
> > less random vrm values if the value provided by the user was larger than 255.
> > Fix by limiting the range to 0..255 using the SENSORS_LIMIT macro.
> > 
> > Cc: Jean Delvare <khali@linux-fr.org>
> > Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
> > ---
> >  drivers/hwmon/it87.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
> > index 0b204e4..bd8775c 100644
> > --- a/drivers/hwmon/it87.c
> > +++ b/drivers/hwmon/it87.c
> > @@ -1324,7 +1324,7 @@ static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr,
> >  	if (kstrtoul(buf, 10, &val) < 0)
> >  		return -EINVAL;
> >  
> > -	data->vrm = val;
> > +	data->vrm = SENSORS_LIMIT(val, 0, 255);
> >  
> >  	return count;
> >  }
> 
> To be honest, I don't know what to do with this.
> 
> You're replacing a silent failure with another. I'd rather return an
> error if the value doesn't fit. as clamping to 255 will lead to a
> failure in vid_from_reg() later anyway.
> 
> On the other hand, we don't validate the VRM value here anyway, it
> could be in the 0-255 range and still lead to a failure in
> vid_from_reg().
> 
> We could improve this of course, but is it worth it? As documented in
> Documentation/hwmon/sysfs-interface, changing the vrm value manually
> should no longer be needed. libsensors does even ignore this attribute
> completely. And newer hardware tends to no longer use the VID pins at
> all. Actually hwmon-vid is in a pretty bad shape at the moment at least
> for all Intel CPUs after Conroe (2007, yeah!) for which we set the VRM
> to 82 i.e. Pentium II/III. And nobody complained yet as far as I know!
> 
If it is like me, I always thought it was a chip problem that it displays
a voltage of 0. There is no warning, so my take is that people simply don't
realize that the CPU model is not recognized.

> So I'm really not sure if it is worth spending time on. It might make
> more sense to turn all these vrm attributes read-only (and ultimately
> kill them altogether.) If we really want to let the user force the vrm
> value if automatic detection failed, it would probably be better done
> as a module parameter to hwmon-vid. It is certainly less flexible, but
> at least we don't have to repeat it in every hwmon driver.
> 
After looking into it a bit more, I think we should move the vrm attributes
to hwmon-vid (and fix hwmon-vid).

Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

  parent reply	other threads:[~2012-01-24 15:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-24  2:49 [lm-sensors] [PATCH 79/79] hwmon: (it87) Fix vrm value range Guenter Roeck
2012-01-24  8:50 ` Jean Delvare
2012-01-24 14:47 ` Guenter Roeck
2012-01-24 15:11 ` Guenter Roeck [this message]
2012-01-24 18:47 ` Guenter Roeck
2012-01-24 19:49 ` Jean Delvare
2012-01-24 20:34 ` Guenter Roeck
2012-01-25 10:01 ` Jean Delvare
2012-01-25 10:17 ` Jean Delvare
2012-01-25 10:31 ` Guenter Roeck
2012-01-26 21:03 ` Jean Delvare
2012-01-26 21:53 ` Guenter Roeck
2012-01-27  8:32 ` Jean Delvare

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=20120124151127.GA23472@ericsson.com \
    --to=guenter.roeck@ericsson.com \
    --cc=lm-sensors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.