diff mbox

mips_malta: Detect format errors for function prom_set

Message ID 1284187585-20953-2-git-send-email-weil@mail.berlios.de
State New
Headers show

Commit Message

Stefan Weil Sept. 11, 2010, 6:46 a.m. UTC
Add the necessary gcc attribute and fix the detected errors.

Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 hw/mips_malta.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Comments

Blue Swirl Sept. 20, 2010, 7:04 p.m. UTC | #1
On Sat, Sep 11, 2010 at 6:46 AM, Stefan Weil <weil@mail.berlios.de> wrote:
> Add the necessary gcc attribute and fix the detected errors.

This is identical to fulong patch, so my comments on that one apply also here.

>
> Cc: Aurelien Jarno <aurelien@aurel32.net>
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
> ---
>  hw/mips_malta.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/hw/mips_malta.c b/hw/mips_malta.c
> index a458c97..deee273 100644
> --- a/hw/mips_malta.c
> +++ b/hw/mips_malta.c
> @@ -684,6 +684,8 @@ static void write_bootloader (CPUState *env, uint8_t *base,
>  }
>
>  static void prom_set(uint32_t* prom_buf, int index, const char *string, ...)
> +    __attribute__ ((format (gnu_printf, 3, 4)));
> +static void prom_set(uint32_t* prom_buf, int index, const char *string, ...)
>  {
>     va_list ap;
>     int32_t table_addr;
> @@ -750,13 +752,13 @@ static int64_t load_kernel(int big_endian)
>     prom_size = ENVP_NB_ENTRIES * (sizeof(int32_t) + ENVP_ENTRY_SIZE);
>     prom_buf = qemu_malloc(prom_size);
>
> -    prom_set(prom_buf, prom_index++, loaderparams.kernel_filename);
> +    prom_set(prom_buf, prom_index++, "%s", loaderparams.kernel_filename);
>     if (initrd_size > 0) {
>         prom_set(prom_buf, prom_index++, "rd_start=0x%" PRIx64 " rd_size=%li %s",
>                  cpu_mips_phys_to_kseg0(NULL, initrd_offset), initrd_size,
>                  loaderparams.kernel_cmdline);
>     } else {
> -        prom_set(prom_buf, prom_index++, loaderparams.kernel_cmdline);
> +        prom_set(prom_buf, prom_index++, "%s", loaderparams.kernel_cmdline);
>     }
>
>     prom_set(prom_buf, prom_index++, "memsize");
> --
> 1.7.0.4
>
>
>
diff mbox

Patch

diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index a458c97..deee273 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -684,6 +684,8 @@  static void write_bootloader (CPUState *env, uint8_t *base,
 }
 
 static void prom_set(uint32_t* prom_buf, int index, const char *string, ...)
+    __attribute__ ((format (gnu_printf, 3, 4)));
+static void prom_set(uint32_t* prom_buf, int index, const char *string, ...)
 {
     va_list ap;
     int32_t table_addr;
@@ -750,13 +752,13 @@  static int64_t load_kernel(int big_endian)
     prom_size = ENVP_NB_ENTRIES * (sizeof(int32_t) + ENVP_ENTRY_SIZE);
     prom_buf = qemu_malloc(prom_size);
 
-    prom_set(prom_buf, prom_index++, loaderparams.kernel_filename);
+    prom_set(prom_buf, prom_index++, "%s", loaderparams.kernel_filename);
     if (initrd_size > 0) {
         prom_set(prom_buf, prom_index++, "rd_start=0x%" PRIx64 " rd_size=%li %s",
                  cpu_mips_phys_to_kseg0(NULL, initrd_offset), initrd_size,
                  loaderparams.kernel_cmdline);
     } else {
-        prom_set(prom_buf, prom_index++, loaderparams.kernel_cmdline);
+        prom_set(prom_buf, prom_index++, "%s", loaderparams.kernel_cmdline);
     }
 
     prom_set(prom_buf, prom_index++, "memsize");