Re: [GIT PULL] MM updates for 6.3-rc1
From: Huang, Ying
Date: Thu Feb 23 2023 - 22:02:56 EST
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> writes:
>
> - gcc 12.2.1 quite reasonable complains about some of the new MM code:
>
> mm/migrate.c: In function ‘__migrate_folio_extract’:
> mm/migrate.c:1050:20: note: randstruct: casting between randomized
> structure pointer types (ssa): ‘struct anon_vma’ and ‘struct
> address_space’
>
> 1050 | *anon_vmap = (void *)dst->mapping;
> | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
>
> and while this doesn't cause a build failure ("note" is different
> from "warning"), I do think something needs to be done. Gcc is right.
> This code seems to *work* simply because it's intentionally
> mis-casting pointers,
Yes. The mis-casting is intentional. I just need some place to hold
the data temporarily (save in __migrate_folio_record() and clear in
__migrate_folio_extract()). And "dst" is newly allocated folio.
> but I think it needs to be seriously looked at and something done to
> make gcc happy (and a *LARGE* comment about it).
Sure. I will check whether there's some way to make gcc happy and add
some comments about that. There's some comments for
__migrate_folio_extract(), but that's isn't enough apprently.)
> That last note is not some merge result, it's purely about the new MM code.
>
[snip]
Best Regards,
Huang, Ying