On July 24, 2019 4:15:28 PM PDT, john.hubb...@gmail.com wrote: >From: John Hubbard <jhubb...@nvidia.com> > >Recent gcc compilers (gcc 9.1) generate warnings about an >out of bounds memset, if you trying memset across several fields >of a struct. This generated a couple of warnings on x86_64 builds. > >Because struct boot_params is __packed__, normal variable >variable assignment will work just as well as a memset here. >Change three u32 fields to be cleared to zero that way, and >just memset the _pad4 field. > >This clears up the build warnings for me. > >Signed-off-by: John Hubbard <jhubb...@nvidia.com> >--- > arch/x86/include/asm/bootparam_utils.h | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > >diff --git a/arch/x86/include/asm/bootparam_utils.h >b/arch/x86/include/asm/bootparam_utils.h >index 101eb944f13c..4df87d4a043b 100644 >--- a/arch/x86/include/asm/bootparam_utils.h >+++ b/arch/x86/include/asm/bootparam_utils.h >@@ -37,12 +37,11 @@ static void sanitize_boot_params(struct boot_params >*boot_params) > if (boot_params->sentinel) { > /* fields in boot_params are left uninitialized, clear them */ > boot_params->acpi_rsdp_addr = 0; >- memset(&boot_params->ext_ramdisk_image, 0, >- (char *)&boot_params->efi_info - >- (char *)&boot_params->ext_ramdisk_image); >- memset(&boot_params->kbd_status, 0, >- (char *)&boot_params->hdr - >- (char *)&boot_params->kbd_status); >+ 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. -- Sent from my Android device with K-9 Mail. Please excuse my brevity.