diff mbox series

uefirtvariable: clean up pedantic static analysis warnings

Message ID 20210922085602.115111-1-colin.king@canonical.com
State Accepted
Headers show
Series uefirtvariable: clean up pedantic static analysis warnings | expand

Commit Message

Colin Ian King Sept. 22, 2021, 8:56 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Static analysis is warning that attributestest may be uninitialized.
Clean this up by setting the variable to zero.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/uefi/uefirtvariable/uefirtvariable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alex Hung Sept. 22, 2021, 7:06 p.m. UTC | #1
On 2021-09-22 2:56 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Static analysis is warning that attributestest may be uninitialized.
> Clean this up by setting the variable to zero.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/uefi/uefirtvariable/uefirtvariable.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 9f2b9dfc..095d2f64 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -129,7 +129,7 @@ static int getvariable_test(
>  	uint8_t testdata[MAX_DATA_LENGTH];
>  	uint64_t dataindex;
>  	uint64_t getdatasize = sizeof(testdata);
> -	uint32_t attributestest;
> +	uint32_t attributestest = 0;
>  
>  	uint8_t data[datasize];
>  	uint32_t i;
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
Alex Hung Sept. 22, 2021, 7:06 p.m. UTC | #2
On 2021-09-22 2:56 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Static analysis is warning that attributestest may be uninitialized.
> Clean this up by setting the variable to zero.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/uefi/uefirtvariable/uefirtvariable.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 9f2b9dfc..095d2f64 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -129,7 +129,7 @@ static int getvariable_test(
>  	uint8_t testdata[MAX_DATA_LENGTH];
>  	uint64_t dataindex;
>  	uint64_t getdatasize = sizeof(testdata);
> -	uint32_t attributestest;
> +	uint32_t attributestest = 0;
>  
>  	uint8_t data[datasize];
>  	uint32_t i;
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Sept. 23, 2021, 2:57 a.m. UTC | #3
On 9/22/21 4:56 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Static analysis is warning that attributestest may be uninitialized.
> Clean this up by setting the variable to zero.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/uefi/uefirtvariable/uefirtvariable.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 9f2b9dfc..095d2f64 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -129,7 +129,7 @@ static int getvariable_test(
>  	uint8_t testdata[MAX_DATA_LENGTH];
>  	uint64_t dataindex;
>  	uint64_t getdatasize = sizeof(testdata);
> -	uint32_t attributestest;
> +	uint32_t attributestest = 0;
>  
>  	uint8_t data[datasize];
>  	uint32_t i;
> 

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox series

Patch

diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
index 9f2b9dfc..095d2f64 100644
--- a/src/uefi/uefirtvariable/uefirtvariable.c
+++ b/src/uefi/uefirtvariable/uefirtvariable.c
@@ -129,7 +129,7 @@  static int getvariable_test(
 	uint8_t testdata[MAX_DATA_LENGTH];
 	uint64_t dataindex;
 	uint64_t getdatasize = sizeof(testdata);
-	uint32_t attributestest;
+	uint32_t attributestest = 0;
 
 	uint8_t data[datasize];
 	uint32_t i;