diff mbox

[1/2] efi_runtime: fix the uninintialized value datasize

Message ID 1474271964-9698-1-git-send-email-ivan.hu@canonical.com
State Accepted
Headers show

Commit Message

Ivan Hu Sept. 19, 2016, 7:59 a.m. UTC
Fix the minor issue found by CoverityScan
CID 1358931 (#1 of 1): Uninitialized scalar variable (UNINIT)9.
uninit_use: Using uninitialized value datasize.
199        prev_datasize = datasize;
200        status = efi.get_variable(name, vd, at, dz, data);

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 efi_runtime/efi_runtime.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Colin Ian King Sept. 19, 2016, 8:14 a.m. UTC | #1
On 19/09/16 08:59, Ivan Hu wrote:
> Fix the minor issue found by CoverityScan
> CID 1358931 (#1 of 1): Uninitialized scalar variable (UNINIT)9.
> uninit_use: Using uninitialized value datasize.
> 199        prev_datasize = datasize;
> 200        status = efi.get_variable(name, vd, at, dz, data);
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  efi_runtime/efi_runtime.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
> index 19f8103..34f452e 100644
> --- a/efi_runtime/efi_runtime.c
> +++ b/efi_runtime/efi_runtime.c
> @@ -174,7 +174,7 @@ static long efi_runtime_get_variable(unsigned long arg)
>  {
>  	struct efi_getvariable __user *getvariable_user;
>  	struct efi_getvariable getvariable;
> -	unsigned long datasize, prev_datasize, *dz;
> +	unsigned long datasize = 0, prev_datasize, *dz;
>  	efi_guid_t vendor_guid, *vd = NULL;
>  	efi_status_t status;
>  	efi_char16_t *name = NULL;
> 
Thanks Ivan,

Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung Sept. 19, 2016, 9:01 p.m. UTC | #2
On 2016-09-19 12:59 AM, Ivan Hu wrote:
> Fix the minor issue found by CoverityScan
> CID 1358931 (#1 of 1): Uninitialized scalar variable (UNINIT)9.
> uninit_use: Using uninitialized value datasize.
> 199        prev_datasize = datasize;
> 200        status = efi.get_variable(name, vd, at, dz, data);
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  efi_runtime/efi_runtime.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
> index 19f8103..34f452e 100644
> --- a/efi_runtime/efi_runtime.c
> +++ b/efi_runtime/efi_runtime.c
> @@ -174,7 +174,7 @@ static long efi_runtime_get_variable(unsigned long arg)
>  {
>  	struct efi_getvariable __user *getvariable_user;
>  	struct efi_getvariable getvariable;
> -	unsigned long datasize, prev_datasize, *dz;
> +	unsigned long datasize = 0, prev_datasize, *dz;
>  	efi_guid_t vendor_guid, *vd = NULL;
>  	efi_status_t status;
>  	efi_char16_t *name = NULL;
>

Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
index 19f8103..34f452e 100644
--- a/efi_runtime/efi_runtime.c
+++ b/efi_runtime/efi_runtime.c
@@ -174,7 +174,7 @@  static long efi_runtime_get_variable(unsigned long arg)
 {
 	struct efi_getvariable __user *getvariable_user;
 	struct efi_getvariable getvariable;
-	unsigned long datasize, prev_datasize, *dz;
+	unsigned long datasize = 0, prev_datasize, *dz;
 	efi_guid_t vendor_guid, *vd = NULL;
 	efi_status_t status;
 	efi_char16_t *name = NULL;