summary refs log tree commit diff stats
path: root/hw/pci-host/sh_pci.c
diff options
context:
space:
mode:
authorSteve Sistare <steven.sistare@oracle.com>2025-07-14 13:36:54 -0700
committerJason Wang <jasowang@redhat.com>2025-07-21 10:21:33 +0800
commitea263e8fd9a8f9cff615631a9bda775f5ddd3f98 (patch)
treee0d9ae0e5e0b75dde0181100ceb7045a2b27b30c /hw/pci-host/sh_pci.c
parent3f9f6299a1bc46ff462142c7398a5953e3640cc2 (diff)
downloadfocaccia-qemu-ea263e8fd9a8f9cff615631a9bda775f5ddd3f98.tar.gz
focaccia-qemu-ea263e8fd9a8f9cff615631a9bda775f5ddd3f98.zip
tap: fix net_init_tap() return code
net_init_tap intends to return 0 for success and -1 on error.  However,
when net_init_tap() succeeds for a multi-queue device, it returns 1,
because of this code where ret becomes 1 when g_unix_set_fd_nonblocking
succeeds:

        ret = g_unix_set_fd_nonblocking(fd, true, NULL);
        if (!ret) {
            ... error ...
    free_fail:
        ...
        return ret;

Luckily, the only current call site checks for negative, rather than non-zero:

  net_client_init1()
      if (net_client_init_fun[](...) < 0)

Also, in the unlikely case that g_unix_set_fd_nonblocking fails and returns
false, ret=0 is returned, and net_client_init1 will use a broken interface.

Fix it to be future proof.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/pci-host/sh_pci.c')
0 files changed, 0 insertions, 0 deletions