Skip to contentSkip to conversation

x86, efi: initial the local variable of DataSize to zero

PATCH In review Lee, Chun-Yi 3 participants 4 messages Apr 26, 2013 – Apr 29, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86, efi: initial the local variable of DataSize to zero

That will be better initial the value of DataSize to zero for the input of GetVariable(), otherwise we will feed a random value. The debug log of input DataSize like this:

...

[  195.915612] EFI Variables Facility v0.08 2004-May-17
[  195.915819] efi: size: 18446744071581821342
[  195.915969] efi:  size': 18446744071581821342
[  195.916324] efi: size: 18446612150714306560
[  195.916632] efi:  size': 18446612150714306560
[  195.917159] efi: size: 18446612150714306560
[  195.917453] efi:  size': 18446612150714306560

...

Found on Acer Aspire V3 BIOS, it will not return the size of data if we input a non-zero DataSize.

Cc Matthew Garrett <[email protected]>
Cc Matt Fleming <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/efi/efi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/platform/efi/efi.c +1 -1
index e4a86a6..cb59732 100644
@@ -204,7 +204,7 @@ static efi_status_t virt_efi_get_next_variable(unsigned long *name_size,
 	}
 
 	if (boot_used_size && !finished) {
-		unsigned long size;
+		unsigned long size = 0;
 		u32 attr;
 		efi_status_t s;
 		void *tmp;
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 31 lines · Chun-Yi

That will be better initial the value of DataSize to zero for the input of GetVariable(), otherwise we will feed a random value. The debug log of input DataSize like this:

...

[  195.915612] EFI Variables Facility v0.08 2004-May-17
[  195.915819] efi: size: 18446744071581821342
[  195.915969] efi:  size': 18446744071581821342
[  195.916324] efi: size: 18446612150714306560
[  195.916632] efi:  size': 18446612150714306560
[  195.917159] efi: size: 18446612150714306560
[  195.917453] efi:  size': 18446612150714306560

...

Found on Acer Aspire V3 BIOS, it will not return the size of data if we input a non-zero DataSize.

Cc Matthew Garrett <[email protected]>
Cc Matt Fleming <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/efi/efi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/platform/efi/efi.c +0 -0
index e4a86a6..cb59732 100644

arch/x86/platform/efi/efi.c static efi_status_t virt_efi_get_next_variable(unsigned long *name_size, · line 210

Quoted 8 lines
arch/x86/platform/efi/efi.c +1 -1
@@ -204,7 +204,7 @@ static efi_status_t virt_efi_get_next_variable(unsigned long *name_size,
 	}
 
 	if (boot_used_size && !finished) {
-		unsigned long size;
+		unsigned long size = 0;
 		u32 attr;
 		efi_status_t s;
 		void *tmp;

Looks good to me. Matthew?

Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
#2 lore raw
In reply to Lee, Chun-Yi

於 六,2013-04-27 於 01:19 +0800,Lee, Chun-Yi 提到:

Quoted 5 lines

That will be better initial the value of DataSize to zero for the input of GetVariable(), otherwise we will feed a random value. The debug log of input DataSize like this:

...

Quoted 8 lines
[  195.915612] EFI Variables Facility v0.08 2004-May-17
[  195.915819] efi: size: 18446744071581821342
[  195.915969] efi:  size': 18446744071581821342
[  195.916324] efi: size: 18446612150714306560
[  195.916632] efi:  size': 18446612150714306560
[  195.917159] efi: size: 18446612150714306560
[  195.917453] efi:  size': 18446612150714306560

...

After applied patch, the log of size like this:

[   82.442042] EFI Variables Facility v0.08 2004-May-17
[   82.442202] efi: size: 0
[   82.442360] efi:  size': 1039
[   82.443828] efi: size: 0
[   82.444127] efi:  size': 2616
[   82.447057] efi: size: 0
[   82.447356] efi:  size': 5832
[   82.452669] efi: size: 0
[   82.453128] efi:  size': 1
[   82.454339] efi: size: 0
[   82.454843] efi:  size': 1
[   82.456173] efi: size: 0
[   82.456764] efi:  size': 8
[   82.458194] efi: size: 0
[   82.458905] efi:  size': 4

The size' is the return value of Acer BIOS, it return right size value then we feed zero DataSize.

Thanks a lot!
Joey Lee

Quoted 25 lines

Found on Acer Aspire V3 BIOS, it will not return the size of data if we input a non-zero DataSize.

Cc Matthew Garrett <[email protected]>
Cc Matt Fleming <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/efi/efi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/platform/efi/efi.c +1 -1
index e4a86a6..cb59732 100644
@@ -204,7 +204,7 @@ static efi_status_t virt_efi_get_next_variable(unsigned long *name_size,
 	}
 
 	if (boot_used_size && !finished) {
-		unsigned long size;
+		unsigned long size = 0;
 		u32 attr;
 		efi_status_t s;
 		void *tmp;
#3 lore raw

於 一,2013-04-29 於 18:25 +0800,joeyli 提到:

Quoted 33 lines

於 六,2013-04-27 於 01:19 +0800,Lee, Chun-Yi 提到:

Quoted 5 lines

That will be better initial the value of DataSize to zero for the input of GetVariable(), otherwise we will feed a random value. The debug log of input DataSize like this:

...

Quoted 8 lines
[  195.915612] EFI Variables Facility v0.08 2004-May-17
[  195.915819] efi: size: 18446744071581821342
[  195.915969] efi:  size': 18446744071581821342
[  195.916324] efi: size: 18446612150714306560
[  195.916632] efi:  size': 18446612150714306560
[  195.917159] efi: size: 18446612150714306560
[  195.917453] efi:  size': 18446612150714306560

...

After applied patch, the log of size like this:

[   82.442042] EFI Variables Facility v0.08 2004-May-17
[   82.442202] efi: size: 0
[   82.442360] efi:  size': 1039
[   82.443828] efi: size: 0
[   82.444127] efi:  size': 2616
[   82.447057] efi: size: 0
[   82.447356] efi:  size': 5832
[   82.452669] efi: size: 0
[   82.453128] efi:  size': 1
[   82.454339] efi: size: 0
[   82.454843] efi:  size': 1
[   82.456173] efi: size: 0
[   82.456764] efi:  size': 8
[   82.458194] efi: size: 0
[   82.458905] efi:  size': 4
Quoted 2 lines

The size' is the return value of Acer BIOS, it return right size value then we feed zero DataSize.

^^^^^^^^^ when

Sorry for typo!
Joey Lee

Quoted 37 lines

Thanks a lot!
Joey Lee

Quoted 17 lines

Found on Acer Aspire V3 BIOS, it will not return the size of data if we input a non-zero DataSize.

Cc Matthew Garrett <[email protected]>
Cc Matt Fleming <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/efi/efi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/platform/efi/efi.c +0 -0
index e4a86a6..cb59732 100644

arch/x86/platform/efi/efi.c static efi_status_t virt_efi_get_next_variable(unsigned long *name_size, · line 210

Quoted 8 lines
arch/x86/platform/efi/efi.c +1 -1
@@ -204,7 +204,7 @@ static efi_status_t virt_efi_get_next_variable(unsigned long *name_size,
 	}
 
 	if (boot_used_size && !finished) {
-		unsigned long size;
+		unsigned long size = 0;
 		u32 attr;
 		efi_status_t s;
 		void *tmp;

--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html