• Hans de Goede's avatar
    hwmon: (f71882fg) Fix various sysfs callback function issues · ce0bfa5e
    Hans de Goede authored
    While working on adding F8000 support I noticed that various of the
    store sysfs functions (and a few of the show also) had issues.
    
    This patch fixes the following issues in these functions:
    * store: storing the result of strto[u]l in an int, resulting in a possible
      overflow before boundary checking
    * store: use of f71882fg_update_device(), we don't want to read the whole
      device in store functions, just the registers we need
    * store: use of cached register values instead of reading the needed regs
      in the store function, including cases where f71882fg_update_device() was
      not used, this could cause real isues
    * show: shown value is a calculation of 2 or more cached register reads,
      without locking the data struct.
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
    ce0bfa5e
f71882fg.c 55.2 KB