diff options
| author | Gui-Dong Han <hanguidong02@gmail.com> | 2025-11-26 19:38:28 +0800 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2025-11-26 07:50:13 -0800 |
| commit | a4d01f3b02d0afb5e4497a1ec5d48da2a326d468 (patch) | |
| tree | 0ac33b8dac1b555b86025d03a1c484726ff46b58 /tools/lib/python/kdoc/parse_data_structs.py | |
| parent | 9eb4fb93069a889aae955c2fbf78f9eb34ac4562 (diff) | |
hwmon: (adm1026) Convert macros to functions to avoid TOCTOU
The macro FAN_FROM_REG evaluates its 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 macro to a static function. 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/
Signed-off-by: Gui-Dong Han <hanguidong02@gmail.com>
Link: https://lore.kernel.org/r/20251126113828.10003-1-hanguidong02@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'tools/lib/python/kdoc/parse_data_structs.py')
0 files changed, 0 insertions, 0 deletions
