summary refs log tree commit diff stats
path: root/hw/core/loader.c
diff options
context:
space:
mode:
authorJiaxun Yang <jiaxun.yang@flygoat.com>2025-01-02 22:47:21 +0000
committerBibo Mao <maobibo@loongson.cn>2025-01-09 14:12:24 +0800
commite3526d0fd73949fd6eafd97711351a7934b496a3 (patch)
treec4bc2fd2fd61600a8bdc77b7a9cb0d915c8f3a83 /hw/core/loader.c
parent3f8bcbba3b320c610689576fc47595f1076198dd (diff)
downloadfocaccia-qemu-e3526d0fd73949fd6eafd97711351a7934b496a3.tar.gz
focaccia-qemu-e3526d0fd73949fd6eafd97711351a7934b496a3.zip
hw/core/loader: Use ssize_t for efi zboot unpacker
Convert to use sszie_t to represent size internally to avoid
large image overflowing the size.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Diffstat (limited to 'hw/core/loader.c')
-rw-r--r--hw/core/loader.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/core/loader.c b/hw/core/loader.c
index c0407e2d0d..4dfdb027ee 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -886,11 +886,11 @@ struct linux_efi_zboot_header {
  *
  * If the image is not a Linux EFI zboot image, do nothing and return success.
  */
-ssize_t unpack_efi_zboot_image(uint8_t **buffer, int *size)
+ssize_t unpack_efi_zboot_image(uint8_t **buffer, ssize_t *size)
 {
     const struct linux_efi_zboot_header *header;
     uint8_t *data = NULL;
-    int ploff, plsize;
+    ssize_t ploff, plsize;
     ssize_t bytes;
 
     /* ignore if this is too small to be a EFI zboot image */