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 -- To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html