[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6846be0e-2711-4da6-82ab-6b348c15edc5@roeck-us.net>
Date: Wed, 26 Nov 2025 07:50:25 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Gui-Dong Han <hanguidong02@...il.com>
Cc: linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hwmon: (adm1026) Convert macros to functions to avoid
TOCTOU
On Wed, Nov 26, 2025 at 07:38:28PM +0800, Gui-Dong Han wrote:
> 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@...il.com>
Applied.
Thanks,
Guenter
Powered by blists - more mailing lists