Skip to contentSkip to conversation

Remove redundant and incorrect memset()

PATCH In review Roy Franz 3 participants 4 messages Oct 4, 2013 2 messages not in the archive EFI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Roy Franz

author
#1 lore raw

PATCH 1/1 Remove redundant and incorrect memset()

Remove a redundant memset() call from efi_relocate_kernel() that was clearing memory that would be used by BSS in non-compressed images loaded with this function. This clear was redundant with the clearing done in the image itself, and also implemented incorrectly with a 0 length.

---
 drivers/firmware/efi/efi-stub-helper.c |    2 --
 1 file changed, 2 deletions(-)
drivers/firmware/efi/efi-stub-helper.c +0 -2
index cc0581d..b6bffbf 100644
@@ -567,8 +567,6 @@ static efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg,
 	 * have been allocated by UEFI, so we can safely use memcpy.
 	 */
 	memcpy((void *)new_addr, (void *)cur_image_addr, image_size);
-	/* Zero any extra space we may have allocated for BSS. */
-	memset((void *)(new_addr + image_size), alloc_size - image_size, 0);
 
 	/* Return the new address of the relocated image. */
 	*image_addr = new_addr;
Signature · 1 line
1.7.10.4
#2 lore raw
Quoted 8 lines · Roy Franz

Remove a redundant memset() call from efi_relocate_kernel() that was clearing memory that would be used by BSS in non-compressed images loaded with this function. This clear was redundant with the clearing done in the image itself, and also implemented incorrectly with a 0 length.

Note the title:

[PATCH] Remove redundant and incorrect memset()

if it's both redundant *and* incorrect then the other memset() must be incorrect too and must be removed as well ;-)

I suspect you wanted the title to say:

[PATCH] Remove redundant memset()

?

Thanks,

Ingo

#3 lore raw
Quoted 14 lines · Ingo Molnar
Quoted 8 lines · Roy Franz

Remove a redundant memset() call from efi_relocate_kernel() that was clearing memory that would be used by BSS in non-compressed images loaded with this function. This clear was redundant with the clearing done in the image itself, and also implemented incorrectly with a 0 length.

Note the title:

Quoted 9 lines

[PATCH] Remove redundant and incorrect memset()

if it's both redundant *and* incorrect then the other memset() must be incorrect too and must be removed as well ;-)

I suspect you wanted the title to say:

[PATCH] Remove redundant memset()

And more importantly:

[PATCH] boot,efi: Remove redundant memset()

A message that is not in the archive (sent off-list or not yet received): CAFECyb_ddUU8p87iOZ43PxW3h-E5cJ-0BUEr9i4Z-VrUez6=Jw@mail.gmail.com

#5 lore raw
Quoted 27 lines · Roy Franz
Quoted 26 lines · Ingo Molnar
Quoted 8 lines · Roy Franz

Remove a redundant memset() call from efi_relocate_kernel() that was clearing memory that would be used by BSS in non-compressed images loaded with this function. This clear was redundant with the clearing done in the image itself, and also implemented incorrectly with a 0 length.

Note the title:

[PATCH] Remove redundant and incorrect memset()

if it's both redundant *and* incorrect then the other memset() must be incorrect too and must be removed as well ;-)

I suspect you wanted the title to say:

[PATCH] Remove redundant memset()

?

Quoted 8 lines
Quoted 3 lines

Thanks,

Ingo

Hi Ingo,

The memset being removed is redundant with a correctly implemented
memset in the kernel itself. The memset being removed is also incorrect,
with a hard coded length of 0.

So it was redundantly clearing nothing? ;-)

Anyway, I agree, the title makes sense.

Thanks,

Ingo