Skip to contentSkip to conversation

loader/linux: Fix type error for reference variable

PATCH In review Tianjia Zhang 2 participants 2 messages Jan 11, 2021 – Feb 26, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 loader/linux: Fix type error for reference variable

relocatable is defined as type grub_uint8_t, this is also one byte definition in linux boot protocol. by semantic definition, it is a bool type. It is not appropriate to treat it as a four bytes, this patch fix this issue.

---
 grub-core/loader/i386/linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/loader/i386/linux.c +1 -1
index d7e68658f..3a06785b2 100644
@@ -736,7 +736,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
       for (align = 0; align < 32; align++)
 	if (grub_le_to_cpu32 (lh.kernel_alignment) & (1 << align))
 	  break;
-      relocatable = grub_le_to_cpu32 (lh.relocatable);
+      relocatable = lh.relocatable;
     }
   else
     {
Signature · 1 line
2.19.1.3.ge56e4f7
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Tianjia Zhang

relocatable is defined as type grub_uint8_t, this is also one byte definition in linux boot protocol. by semantic definition, it is a bool type. It is not appropriate to treat it as a four bytes, this patch fix this issue.

Daniel

Quoted 19 lines
---
 grub-core/loader/i386/linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/loader/i386/linux.c +1 -2
index d7e68658f..3a06785b2 100644
@@ -736,7 +736,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
       for (align = 0; align < 32; align++)
 	if (grub_le_to_cpu32 (lh.kernel_alignment) & (1 << align))
 	  break;
-      relocatable = grub_le_to_cpu32 (lh.relocatable);
+      relocatable = lh.relocatable;
     }
   else
     {
--

2.19.1.3.ge56e4f7