summaryrefslogtreecommitdiff
path: root/tools/lib/python/abi/abi_regex.py
diff options
context:
space:
mode:
authorGui-Dong Han <hanguidong02@gmail.com>2025-11-20 12:13:31 +0800
committerGuenter Roeck <linux@roeck-us.net>2025-11-21 07:50:18 -0800
commit96710819d0ce6d1e42be751f6bbed18b6e9ea6d1 (patch)
tree0c9d65a92484de99e095f0eb747c0193fd9e4753 /tools/lib/python/abi/abi_regex.py
parentd56933e74d0d691dcd642876feda0b30f397e2ad (diff)
hwmon: (vt1211) Convert macros to functions to avoid TOCTOU
The macros IN_FROM_REG, TEMP_FROM_REG, and RPM_FROM_REG evaluate their arguments multiple times. These macros are used in lockless show functions involving shared driver data, leading to Time-of-Check to Time-of-Use race conditions. For example, RPM_FROM_REG checks if a value is 0 or 255, and then uses it in a division. If the value is modified by another thread to 0 after the check but before the division, it causes a divide-by-zero error. Convert these macros to static functions. This guarantees that arguments are evaluated only once (pass-by-value), fixing the race conditions. Adhere to the principle of minimal changes by only converting the specific macros involved in these 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/20251120041331.1917570-1-hanguidong02@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'tools/lib/python/abi/abi_regex.py')
0 files changed, 0 insertions, 0 deletions