[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9ed5116f-cf36-49f6-833e-75eeab4570b4@roeck-us.net>
Date: Wed, 15 Nov 2023 05:12:12 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: Jean Delvare <jdelvare@...e.com>, Joel Stanley <joel@....id.au>,
Andrew Jeffery <andrew@...econstruct.com.au>,
linux-hwmon@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-aspeed@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2][next] hwmon: (aspeed-pwm-tacho) Fix
-Wstringop-overflow warning in aspeed_create_fan_tach_channel()
On Tue, Nov 14, 2023 at 01:53:08PM -0600, Gustavo A. R. Silva wrote:
> Based on the documentation below, the maximum number of Fan tach
> channels is 16:
>
> Documentation/devicetree/bindings/hwmon/aspeed-pwm-tacho.txt:45:
> 45 - aspeed,fan-tach-ch : should specify the Fan tach input channel.
> 46 integer value in the range 0 through 15, with 0 indicating
> 47 Fan tach channel 0 and 15 indicating Fan tach channel 15.
> 48 At least one Fan tach input channel is required.
>
> However, the compiler doesn't know that, and legitimaly warns about a potential
> overwrite in array `u8 fan_tach_ch_source[16]` in `struct aspeed_pwm_tacho_data`,
> in case `index` takes a value outside the boundaries of the array:
>
Still messes the point. This isn't about "the compiler doesn't know that",
it is a real bug which may result in out-of-bounds accesses.
Oh, never mind, I'll just apply it.
Guenter
Powered by blists - more mailing lists