diff options
| author | Gui-Dong Han <hanguidong02@gmail.com> | 2025-11-28 20:38:16 +0800 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2025-11-28 08:30:24 -0800 |
| commit | 07272e883fc61574b8367d44de48917f622cdd83 (patch) | |
| tree | fd44ee146a3a778e13e668460e417931966ffecb /tools/lib/python/abi/helpers.py | |
| parent | 02f0ad8e8de8cf5344f8f0fa26d9529b8339da47 (diff) | |
hwmon: (w83l786ng) Convert macros to functions to avoid TOCTOU
The macros FAN_FROM_REG and TEMP_FROM_REG evaluate their arguments
multiple times. When used in lockless contexts involving shared driver
data, this causes Time-of-Check to Time-of-Use (TOCTOU) race
conditions.
Convert the macros to static functions. This guarantees that arguments
are evaluated only once (pass-by-value), preventing the race
conditions.
Adhere to the principle of minimal changes by only converting macros
that evaluate arguments multiple times and are used in lockless
contexts.
Link: https://lore.kernel.org/all/CALbr=LYJ_ehtp53HXEVkSpYoub+XYSTU8Rg=o1xxMJ8=5z8B-g@mail.gmail.com/
Fixes: 85f03bccd6e0 ("hwmon: Add support for Winbond W83L786NG/NR")
Cc: stable@vger.kernel.org
Signed-off-by: Gui-Dong Han <hanguidong02@gmail.com>
Link: https://lore.kernel.org/r/20251128123816.3670-1-hanguidong02@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'tools/lib/python/abi/helpers.py')
0 files changed, 0 insertions, 0 deletions
