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