qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] change get_image_size return type to int64_t


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH] change get_image_size return type to int64_t
Date: Wed, 12 Sep 2018 07:19:46 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 09/12/2018 02:14 AM, Li Zhijian wrote:
> @@ -838,7 +838,8 @@ static void load_linux(PCMachineState *pcms,
>                         FWCfgState *fw_cfg)
>  {
>      uint16_t protocol;
> -    int setup_size, kernel_size, initrd_size = 0, cmdline_size;
> +    int setup_size, kernel_size, cmdline_size;
> +    int64_t initrd_size = 0;
>      int dtb_size, setup_data_offset;
>      uint32_t initrd_max;
>      uint8_t header[8192], *setup, *kernel, *initrd_data;
> @@ -974,6 +975,10 @@ static void load_linux(PCMachineState *pcms,
>              fprintf(stderr, "qemu: error reading initrd %s: %s\n",
>                      initrd_filename, strerror(errno));
>              exit(1);
> +        } else if (initrd_size >= UINT32_MAX) {
> +            fprintf(stderr, "qemu: failed to load initrd beyond 4G(%ld)\n",
> +                    initrd_size);

You need to use PRId64 instead of %ld here.
Otherwise this will fail 32-bit host builds.

You could try this yourself with e.g.

  make address@hidden


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]