qemu-devel
[Top][All Lists]
Advanced

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

Re: [PULL 13/13] dump/win_dump: add 32-bit guest Windows support


From: Richard Henderson
Subject: Re: [PULL 13/13] dump/win_dump: add 32-bit guest Windows support
Date: Thu, 21 Apr 2022 10:24:22 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0

On 4/21/22 06:59, Marc-André Lureau wrote:
    -    check_header(h, &local_err);
    +    check_header(h, &x64, &local_err);
          if (local_err) {
              error_propagate(errp, local_err);
              return;
          }

    +    hdr_size = x64 ? sizeof(WinDumpHeader64) : sizeof(WinDumpHeader32);


The compiler is not smart enough here:
../dump/win_dump.c:416:46: error: 'x64' may be used uninitialized in this function [-Werror=maybe-uninitialized]
hdr_size = x64 ? sizeof(WinDumpHeader64) : sizeof(WinDumpHeader32);

The compiler might do better with

    if (!check_header(h, &x64, err)) {
        return;
    }

where check_header returns false on failure (which is recommended by qapi/error.h). Right now, it can't see through error_setg() to see that local_err must be set when x64 isn't.


I'll simply initialize the variable to true by default.

Or that.

I'll discard this pull request and expect a v2.


r~



reply via email to

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