All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] PATCH: f71882fg: fix fan_to/from_reg prototypes
@ 2008-12-16 16:18 Hans de Goede
  2008-12-16 16:48 ` Jean Delvare
  0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2008-12-16 16:18 UTC (permalink / raw)
  To: lm-sensors

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

Hi Jean,

The RPM after conversion from / before conversion to a register value can be
much more then 65535 (up to 1500000), so putting this into an u16 can cause
overflows. This changes the functions to use an int to store / get RPM instead.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans

[-- Attachment #2: hwmon-f71882fg-18-fix-fan-reg-funcs.patch --]
[-- Type: text/plain, Size: 740 bytes --]

The RPM after conversion from / before conversion to a register value can be
much more then 65535 (up to 1500000), so putting this into an u16 can cause
overflows. This changes the functions to use an int to store / get RPM instead.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
--- f71882fg.c.17-applied	2008-12-15 16:30:57.000000000 +0100
+++ f71882fg.c	2008-12-16 17:14:53.000000000 +0100
@@ -810,12 +810,12 @@ static inline void superio_exit(int base
 	outb(SIO_LOCK_KEY, base);
 }
 
-static inline u16 fan_from_reg(u16 reg)
+static inline int fan_from_reg(u16 reg)
 {
 	return reg ? (1500000 / reg) : 0;
 }
 
-static inline u16 fan_to_reg(u16 fan)
+static inline u16 fan_to_reg(int fan)
 {
 	return fan ? (1500000 / fan) : 0;
 }

[-- Attachment #3: Type: text/plain, Size: 153 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [lm-sensors] PATCH: f71882fg: fix fan_to/from_reg prototypes
  2008-12-16 16:18 [lm-sensors] PATCH: f71882fg: fix fan_to/from_reg prototypes Hans de Goede
@ 2008-12-16 16:48 ` Jean Delvare
  0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2008-12-16 16:48 UTC (permalink / raw)
  To: lm-sensors

On Tue, 16 Dec 2008 17:18:24 +0100, Hans de Goede wrote:
> Hi Jean,
> 
> The RPM after conversion from / before conversion to a register value can be
> much more then 65535 (up to 1500000), so putting this into an u16 can cause
> overflows. This changes the functions to use an int to store / get RPM instead.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Applied, thanks.

-- 
Jean Delvare

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-16 16:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-16 16:18 [lm-sensors] PATCH: f71882fg: fix fan_to/from_reg prototypes Hans de Goede
2008-12-16 16:48 ` Jean Delvare

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.