|
|
453bef |
From 2ca5e334bbc5309fc6329b1263bd8d3d85712d03 Mon Sep 17 00:00:00 2001
|
|
|
453bef |
From: Peter Jones <pjones@redhat.com>
|
|
|
453bef |
Date: Tue, 9 May 2017 09:43:29 -0400
|
|
|
453bef |
Subject: [PATCH 12/13] Try harder to satisfy coverity about the structure of
|
|
|
453bef |
update_info.
|
|
|
453bef |
|
|
|
453bef |
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
453bef |
---
|
|
|
453bef |
efi/fwupdate.c | 2 +-
|
|
|
453bef |
efi/mkvar2.c | 2 +-
|
|
|
453bef |
include/fwup-efi.h | 3 ++-
|
|
|
453bef |
linux/libfwup.c | 6 +++---
|
|
|
453bef |
4 files changed, 7 insertions(+), 6 deletions(-)
|
|
|
453bef |
|
|
|
453bef |
diff --git a/efi/fwupdate.c b/efi/fwupdate.c
|
|
|
453bef |
index 942d347..d009267 100644
|
|
|
453bef |
--- a/efi/fwupdate.c
|
|
|
453bef |
+++ b/efi/fwupdate.c
|
|
|
453bef |
@@ -674,7 +674,7 @@ add_capsule(update_table *update, EFI_CAPSULE_HEADER **capsule_out,
|
|
|
453bef |
UINTN fsize = 0;
|
|
|
453bef |
EFI_CAPSULE_HEADER *capsule;
|
|
|
453bef |
|
|
|
453bef |
- rc = open_file((EFI_DEVICE_PATH *)update->info->dp, &fh;;
|
|
|
453bef |
+ rc = open_file((EFI_DEVICE_PATH *)update->info->dp_buf, &fh;;
|
|
|
453bef |
if (EFI_ERROR(rc))
|
|
|
453bef |
return rc;
|
|
|
453bef |
|
|
|
453bef |
diff --git a/efi/mkvar2.c b/efi/mkvar2.c
|
|
|
453bef |
index 0c60a5a..a02a912 100644
|
|
|
453bef |
--- a/efi/mkvar2.c
|
|
|
453bef |
+++ b/efi/mkvar2.c
|
|
|
453bef |
@@ -44,7 +44,7 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
|
|
453bef |
InitializeLib(image, systab);
|
|
|
453bef |
|
|
|
453bef |
ZeroMem(&info->time_attempted, sizeof (info->time_attempted));
|
|
|
453bef |
- CopyMem(info->dp, devicepath, sizeof (devicepath)-1);
|
|
|
453bef |
+ CopyMem(info->dp_buf, devicepath, sizeof (devicepath)-1);
|
|
|
453bef |
CopyMem(&info->guid, &guid, sizeof (guid));
|
|
|
453bef |
|
|
|
453bef |
EFI_STATUS rc = uefi_call_wrapper(RT->SetVariable, 5, L"FwUpdates",
|
|
|
453bef |
diff --git a/include/fwup-efi.h b/include/fwup-efi.h
|
|
|
453bef |
index fe1ec90..37f3459 100644
|
|
|
453bef |
--- a/include/fwup-efi.h
|
|
|
453bef |
+++ b/include/fwup-efi.h
|
|
|
453bef |
@@ -31,7 +31,8 @@ typedef struct update_info_s {
|
|
|
453bef |
/* variadic device path */
|
|
|
453bef |
union {
|
|
|
453bef |
efidp_header *dp_ptr;
|
|
|
453bef |
- uint8_t dp[sizeof(efidp_header)];
|
|
|
453bef |
+ efidp_header dp;
|
|
|
453bef |
+ uint8_t dp_buf[0];
|
|
|
453bef |
};
|
|
|
453bef |
} __attribute__((__packed__)) update_info;
|
|
|
453bef |
|
|
|
453bef |
diff --git a/linux/libfwup.c b/linux/libfwup.c
|
|
|
453bef |
index b29a0e5..232eb77 100644
|
|
|
453bef |
--- a/linux/libfwup.c
|
|
|
453bef |
+++ b/linux/libfwup.c
|
|
|
453bef |
@@ -321,7 +321,7 @@ get_err:
|
|
|
453bef |
goto get_err;
|
|
|
453bef |
}
|
|
|
453bef |
|
|
|
453bef |
- ssize_t sz = efidp_size((efidp)local->dp);
|
|
|
453bef |
+ ssize_t sz = efidp_size((efidp)local->dp_buf);
|
|
|
453bef |
if (sz < 0) {
|
|
|
453bef |
efi_error("efidp_size() failed");
|
|
|
453bef |
free(data);
|
|
|
453bef |
@@ -337,7 +337,7 @@ get_err:
|
|
|
453bef |
return -1;
|
|
|
453bef |
}
|
|
|
453bef |
|
|
|
453bef |
- memcpy(dp, local->dp, (size_t)sz);
|
|
|
453bef |
+ memcpy(dp, local->dp_buf, (size_t)sz);
|
|
|
453bef |
local->dp_ptr = dp;
|
|
|
453bef |
|
|
|
453bef |
*info = local;
|
|
|
453bef |
@@ -394,7 +394,7 @@ err:
|
|
|
453bef |
return -1;
|
|
|
453bef |
|
|
|
453bef |
memcpy(info2, info, sizeof(*info));
|
|
|
453bef |
- memcpy(info2->dp, info->dp_ptr, dps);
|
|
|
453bef |
+ memcpy(info2->dp_buf, info->dp_ptr, dps);
|
|
|
453bef |
|
|
|
453bef |
uint32_t attributes = EFI_VARIABLE_NON_VOLATILE
|
|
|
453bef |
| EFI_VARIABLE_BOOTSERVICE_ACCESS
|
|
|
453bef |
--
|
|
|
453bef |
2.12.2
|
|
|
453bef |
|