From 88ff7cb1c8bb411572ac82cd7e312281d8e09d3b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 9 Nov 2022 19:14:39 -0700 Subject: image: Correct strncpy() warning with image_set_name() gcc 12 seems to warn on strncpy() as a matter of course. Rewrite the code a different way to do the same thing, to avoid the warning. Signed-off-by: Simon Glass --- include/image.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/image.h b/include/image.h index 65d0d4f4387..6f21dafba8c 100644 --- a/include/image.h +++ b/include/image.h @@ -853,7 +853,13 @@ image_set_hdr_b(comp) /* image_set_comp */ static inline void image_set_name(struct legacy_img_hdr *hdr, const char *name) { - strncpy(image_get_name(hdr), name, IH_NMLEN); + /* + * This is equivalent to: strncpy(image_get_name(hdr), name, IH_NMLEN); + * + * Use the tortured code below to avoid a warning with gcc 12. We do not + * want to include a nul terminator if the name is of length IH_NMLEN + */ + memcpy(image_get_name(hdr), name, strnlen(name, IH_NMLEN)); } int image_check_hcrc(const struct legacy_img_hdr *hdr); -- cgit v1.3.1 From 0524bfc2976f3d8f2e3a693eedfcad1299e91a94 Mon Sep 17 00:00:00 2001 From: Sughosh Ganu Date: Thu, 10 Nov 2022 22:34:30 +0530 Subject: sandbox: Move the capsule GUID declarations to board file The sandbox config file is to be removed. Move the GUID declarations needed for capsule update functionality to the board file where they are used. Signed-off-by: Sughosh Ganu Reviewed-by: Simon Glass --- board/sandbox/sandbox.c | 13 +++++++++++++ include/configs/sandbox.h | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c index 4d89f9be1cd..4c655dfd495 100644 --- a/board/sandbox/sandbox.c +++ b/board/sandbox/sandbox.c @@ -30,6 +30,19 @@ gd_t *gd; #if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) +/* GUIDs for capsule updatable firmware images */ +#define SANDBOX_UBOOT_IMAGE_GUID \ + EFI_GUID(0x09d7cf52, 0x0720, 0x4710, 0x91, 0xd1, \ + 0x08, 0x46, 0x9b, 0x7f, 0xe9, 0xc8) + +#define SANDBOX_UBOOT_ENV_IMAGE_GUID \ + EFI_GUID(0x5a7021f5, 0xfef2, 0x48b4, 0xaa, 0xba, \ + 0x83, 0x2e, 0x77, 0x74, 0x18, 0xc0) + +#define SANDBOX_FIT_IMAGE_GUID \ + EFI_GUID(0x3673b45d, 0x6a7c, 0x46f3, 0x9e, 0x60, \ + 0xad, 0xab, 0xb0, 0x3f, 0x79, 0x37) + struct efi_fw_image fw_images[] = { #if defined(CONFIG_EFI_CAPSULE_FIRMWARE_RAW) { diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 5168e2fa353..0dcb2ebc316 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -10,19 +10,6 @@ #define CONFIG_MALLOC_F_ADDR 0x0010000 -/* GUIDs for capsule updatable firmware images */ -#define SANDBOX_UBOOT_IMAGE_GUID \ - EFI_GUID(0x09d7cf52, 0x0720, 0x4710, 0x91, 0xd1, \ - 0x08, 0x46, 0x9b, 0x7f, 0xe9, 0xc8) - -#define SANDBOX_UBOOT_ENV_IMAGE_GUID \ - EFI_GUID(0x5a7021f5, 0xfef2, 0x48b4, 0xaa, 0xba, \ - 0x83, 0x2e, 0x77, 0x74, 0x18, 0xc0) - -#define SANDBOX_FIT_IMAGE_GUID \ - EFI_GUID(0x3673b45d, 0x6a7c, 0x46f3, 0x9e, 0x60, \ - 0xad, 0xab, 0xb0, 0x3f, 0x79, 0x37) - /* Size of our emulated memory */ #define SB_CONCAT(x, y) x ## y #define SB_TO_UL(s) SB_CONCAT(s, UL) -- cgit v1.3.1