[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6eb501b7-501a-4e55-b340-88c387c1078c@roeck-us.net>
Date: Tue, 10 Jun 2025 13:52:33 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Jean Delvare <jdelvare@...e.com>,
Eddie James <eajames@...ux.vnet.ibm.com>,
Arnd Bergmann <arnd@...db.de>, Al Viro <viro@...iv.linux.org.uk>,
linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hwmon: occ: fix unaligned accesses
On Tue, Jun 10, 2025 at 11:25:49AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> Passing a pointer to an unaligned integer as a function argument is
> undefined behavior:
>
> drivers/hwmon/occ/common.c:492:27: warning: taking address of packed member 'accumulator' of class or structure 'power_sensor_2' may result in an unaligned pointer value [-Waddress-of-packed-member]
> 492 | val = occ_get_powr_avg(&power->accumulator,
> | ^~~~~~~~~~~~~~~~~~
> drivers/hwmon/occ/common.c:493:13: warning: taking address of packed member 'update_tag' of class or structure 'power_sensor_2' may result in an unaligned pointer value [-Waddress-of-packed-member]
> 493 | &power->update_tag);
> | ^~~~~~~~~~~~~~~~~
>
> Move the get_unaligned() calls out of the function and pass these
> through argument registers instead.
>
> Fixes: c10e753d43eb ("hwmon (occ): Add sensor types and versions")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
Applied.
Thanks,
Guenter
Powered by blists - more mailing lists