qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] load_elf: fix iterator type in glue
@ 2023-12-21  8:08 Anastasia Belova
  2023-12-26 12:03 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 7+ messages in thread
From: Anastasia Belova @ 2023-12-21  8:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anastasia Belova, sdl.qemu

file_size is uint32_t, so j < file_size should be
uint32_t too.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 7ef295ea5b ("loader: Add data swap option to load-elf")
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
---
 include/hw/elf_ops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
index 0a5c258fe6..1defccaa71 100644
--- a/include/hw/elf_ops.h
+++ b/include/hw/elf_ops.h
@@ -500,7 +500,7 @@ static ssize_t glue(load_elf, SZ)(const char *name, int fd,
             }
 
             if (data_swab) {
-                int j;
+                uint32_t j;
                 for (j = 0; j < file_size; j += (1 << data_swab)) {
                     uint8_t *dp = data + j;
                     switch (data_swab) {
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-01-15 17:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-21  8:08 [PATCH] load_elf: fix iterator type in glue Anastasia Belova
2023-12-26 12:03 ` Philippe Mathieu-Daudé
2024-01-04 11:24   ` Peter Maydell
2024-01-12 11:45     ` [PATCH v2] load_elf: fix iterators' types for elf file processing Anastasia Belova
2024-01-12 12:46       ` Peter Maydell
2024-01-15  9:22         ` [PATCH v3] load_elf: fix iterator's type " Anastasia Belova
2024-01-15 17:16           ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).