Skip to contentSkip to conversation

grub-core/script/lexer.c: Remove dead increment

PATCH In review Elyes Haouas 2 participants 3 messages Feb 28, 2022 – Mar 1, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 grub-core/script/lexer.c: Remove dead increment

The value stored to 'len' is never read

---
 grub-core/script/lexer.c | 1 -
 1 file changed, 1 deletion(-)
grub-core/script/lexer.c +0 -1
index 52004d059..00f6ef184 100644
@@ -216,7 +216,6 @@ grub_script_lexer_yywrap (struct grub_parser_param *parserstate,
       grub_free (line);
 
       line = p;
-      len = len + plen;
     }
 
   buffer = yy_scan_string (line, lexerstate->yyscanner);
Signature · 1 line
2.35.1
#1 lore raw

PATCH 2/2 grub-core/loader/i386/multiboot_mbi.c: Remove dead increment

The value stored to 'ptrdest' is never read

---
 grub-core/loader/i386/multiboot_mbi.c | 1 -
 1 file changed, 1 deletion(-)
grub-core/loader/i386/multiboot_mbi.c +0 -1
index a67d9d0a8..663b25cc5 100644
@@ -609,7 +609,6 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
   ptrorig += sizeof (struct grub_vbe_info_block);
   ptrdest += sizeof (struct grub_vbe_info_block);
   ptrorig += sizeof (struct grub_vbe_mode_info_block);
-  ptrdest += sizeof (struct grub_vbe_mode_info_block);
 #endif
 
 #ifdef GRUB_MACHINE_EFI
Signature · 1 line
2.35.1
#2 lore raw

Re: [PATCH 2/2] grub-core/loader/i386/multiboot_mbi.c: Remove dead increment

Quoted 12 lines · On Mon, 28 Feb 2022 21:48:35 +0100 Elyes Haouas <[email protected]> wrote:

The value stored to 'ptrdest' is never read

---
 grub-core/loader/i386/multiboot_mbi.c | 1 -
 1 file changed, 1 deletion(-)
grub-core/loader/i386/multiboot_mbi.c +0 -0
index a67d9d0a8..663b25cc5 100644

grub-core/loader/i386/multiboot_mbi.c grub_multiboot_make_mbi (grub_uint32_t *target) · line 612

Quoted 4 lines
grub-core/loader/i386/multiboot_mbi.c +0 -1
@@ -609,7 +609,6 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
   ptrorig += sizeof (struct grub_vbe_info_block);
   ptrdest += sizeof (struct grub_vbe_info_block);
   ptrorig += sizeof (struct grub_vbe_mode_info_block);
-  ptrdest += sizeof (struct grub_vbe_mode_info_block);

I'm not familiar with this code and just did a cursory glance, but it looks to me like none of these above 4 lines are used nor in the "if" block above them. This begs for more investigation. It looks to me like either there's code missing after this or this apparently useless code wasn't removed during a refactor. Both ptrdest and ptrorig are stack variables, so I don't think there's any magic in writing to them. What am I missing? Until this is clarified, I don't think we should be removing this code.

Glenn

Quoted 3 lines
grub-core/loader/i386/multiboot_mbi.c +0 -0
 #endif
 
 #ifdef GRUB_MACHINE_EFI