lkml.org 
[lkml]   [2019]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/1] x86/boot: clear some fields explicitly
From
Date
On 7/24/19 7:12 PM, hpa@zytor.com wrote:
> On July 24, 2019 4:15:28 PM PDT, john.hubbard@gmail.com wrote:
>> From: John Hubbard <jhubbard@nvidia.com>
...
>> + boot_params->ext_ramdisk_image = 0;
>> + boot_params->ext_ramdisk_size = 0;
>> + boot_params->ext_cmd_line_ptr = 0;
>> +
>> + memset(&boot_params->_pad4, 0, sizeof(boot_params->_pad4));
>> memset(&boot_params->_pad7[0], 0,
>> (char *)&boot_params->edd_mbr_sig_buffer[0] -
>> (char *)&boot_params->_pad7[0]);
>
> The problem with this is that it will break silently when changes are made to this structure.
>
> So, that is a NAK from me.
>

Understood. It occurs to me, though, that it would be trivial to
just add build time assertions to check a few struct member offset
values, and fail out if they changed. That would give us everything:
warnings-free builds, and no silent failures.

Thoughts?

thanks,
--
John Hubbard
NVIDIA

\
 
 \ /
  Last update: 2019-07-25 08:51    [W:0.094 / U:0.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site