Re: [PATCH 1/1] x86/boot: clear some fields explicitly
From: H. Peter Anvin
Date: Thu Jul 25 2019 - 16:39:11 EST
On 7/25/19 12:22 AM, Thomas Gleixner wrote:
>> The problem with this is that it will break silently when changes are
>> made to this structure.
> That's not really the worst problem. Changes to that struct which touch any
> of the to be cleared ranges will break anyway if not handled correctly in
> the sanitizer function.
Not really... that's kind of the point (the cleared ranges are cleared
explicitly because the boot loader failed to do so, so zeroing them is what
the boot loader should have done.)
The most correct way to address this would be to have an explicit list of
members to be *preserved* even if the sentinel triggers.
The easy way would be to put in a suitable cast to clear the warning -- I
would not be surprised if an explicit cast to something like (void *) would
quiet the warning, or else (yuck) put in an explicit (well-commented) #pragma
to shut it up.