Re: i386: kernel/sched/debug.c:341:57: error: integer overflow in expression of type 'long int' results in '-100663296' [-Werror=overflow]

From: Dan Carpenter
Date: Thu Aug 01 2024 - 11:26:15 EST


On Thu, Aug 01, 2024 at 08:42:07PM +0530, Naresh Kamboju wrote:
> The i386 kselftest merge config build failed due to following warnings / errors
> on today's Linux next-20240801 tag with gcc-13.
>
> Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
>
> Build log:
> --------
> In file included from kernel/sched/build_utility.c:72:
> kernel/sched/debug.c:341:57: error: integer overflow in expression of
> type 'long int' results in '-100663296' [-Werror=overflow]
> 341 | static unsigned long fair_server_period_max = (1 << 22) *
> NSEC_PER_USEC; /* ~4 seconds */
> | ^
> cc1: all warnings being treated as errors

It needs to be 1U << 22. It's probably more traditional to write it as
1UL << 22, although they equivalent here.

I can send a patch for that.

regards,
dan carpenter