Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (lm87) Fix vrm write operation

vrm is an u8, so the written value needs to be limited to [0, 255].

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Axel Lin and committed by
Guenter Roeck
fa642d9d db59ac43

+4
+4
drivers/hwmon/lm87.c
··· 617 617 err = kstrtoul(buf, 10, &val); 618 618 if (err) 619 619 return err; 620 + 621 + if (val > 255) 622 + return -EINVAL; 623 + 620 624 data->vrm = val; 621 625 return count; 622 626 }