Re: [GIT PULL] hwmon updates for v5.20

From: Linus Torvalds
Date: Sun Aug 07 2022 - 12:48:50 EST


Added Kees - this *looks* like it's a compiler bug.

On Sun, Aug 7, 2022 at 3:07 AM Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
> Just a quick build regression report, i386 allmodconfig fails to build due
> to a 'string overread' compiler warning in drivers/hwmon/lm90.o:

I tried to see it here with gcc-12.1, but it's not triggering, so it's
presumably compiler-dependent.

Which compiler is it?

> inlined from ‘lm90_detect’ at drivers/hwmon/lm90.c:2550:2:
> warning: ‘__builtin_strlen’ reading 1 or more bytes from a region of size 0 [-Wstringop-overread]

Normally it's easier to see what triggers it, but here it's just that

strlcpy(info->type, name, I2C_NAME_SIZE);

so it's either just the compiler being confused (we've seen that
before), or it's one of the

name = lm90_detect_xyz(client, chip_id, config1, convrate);

calls in the case statement above that returns something that gcc then
thinks is bad.

However, from an admittedly quick look, all those functions simply
seem to return either NULL or a simple constant string.

Which makes me think "oh, it's gcc being confused by the fortification
code again".

Kees? Do you see anything I don't?

I get the feeling that we should just disable
-Werror=stringop-overread and/or FORTIFY_SOURCE for that
compiler/architecture combination if it's just gcc causing bogus
errors.

Linus