summaryrefslogtreecommitdiff
path: root/tools/lib/python/kdoc/kdoc_output.py
diff options
context:
space:
mode:
authorGui-Dong Han <hanguidong02@gmail.com>2025-11-25 00:59:00 +0800
committerGuenter Roeck <linux@roeck-us.net>2025-11-24 11:47:45 -0800
commitfe598ab37e472514e769d3eeb0456cddb3b8ba9f (patch)
tree06a9c5adbff0a5a029b5e29381fe89faa8014ee3 /tools/lib/python/kdoc/kdoc_output.py
parent4faaa77d6b32347ea6af74d5fd2f34c3922aeee6 (diff)
hwmon: (vt8231) Convert macros to functions to avoid TOCTOU
The macro FAN_FROM_REG evaluates its arguments multiple times. When used with shared driver data, this leads to Time-of-Check to Time-of-Use (TOCTOU) race conditions, potentially causing divide-by-zero errors. Convert the macro to a static function to ensure arguments are evaluated only once. Additionally, in fan_div_store, move the reading of the old register value and the calculation of the minimum limit inside the update lock. This ensures that the read-modify-write sequence operates on consistent data, preventing race conditions during fan divider updates. Link: https://lore.kernel.org/all/CALbr=LYJ_ehtp53HXEVkSpYoub+XYSTU8Rg=o1xxMJ8=5z8B-g@mail.gmail.com/ Signed-off-by: Gui-Dong Han <hanguidong02@gmail.com> Link: https://lore.kernel.org/r/20251124165900.4713-1-hanguidong02@gmail.com [groeck: Dropped unnecessary line split] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'tools/lib/python/kdoc/kdoc_output.py')
0 files changed, 0 insertions, 0 deletions