Messages in this thread | | | Subject | Re: [PATCH 1/1] x86/boot: clear some fields explicitly | From | John Hubbard <> | Date | Wed, 24 Jul 2019 23:49:22 -0700 |
| |
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
| |