Re: New sparse warning from min_t(): expression using sizeof(void)

From: Joey Pabalinas
Date: Mon Apr 23 2018 - 03:42:02 EST


On Mon, Apr 23, 2018 at 09:20:14AM +0300, Luciano Coelho wrote:
> Thanks, this solves the problem for me, but I'm still getting a lot of
> this:
>
> ./include/linux/mm.h:533:24: warning: constant 0xffffc90000000000 is so big it is unsigned long
>
> Is there a patch in sparse to solve this one as well? Or is this an
> actual error that must be fixed in mm.h?

This is definitely a valid warning in the general case (integer promotion
rules can cause *incredibly* difficult to find bugs if you overlook them,
so it's very useful to get a warning when a promotion occurs implicitly to
integer constants).

In this case though, you are comparing it against `unsigned long addr`
which is exactly the same type, so there's no bug.

It could possibly be argued that in:

> arch/x86/include/asm/pgtable_64_types.h:122: # define VMALLOC_START __VMALLOC_BASE_L4
> arch/x86/include/asm/pgtable_64_types.h:108: #define __VMALLOC_BASE_L4 0xffffc90000000000

__VMALLOC_BASE_L4 would be better written as 0xffffc90000000000UL, which would
indeed shut up sparse.

--
Cheers,
Joey Pabalinas

Attachment: signature.asc
Description: PGP signature