Skip to content
Commit 669827c6 authored by Murilo Opsfelder Araujo's avatar Murilo Opsfelder Araujo Committed by Bruce Ashfield
Browse files

virtio-pci: Remove wrong address verification in vp_del_vqs()

GCC 12 enhanced -Waddress when comparing array address to null [0],
which warns:

    drivers/virtio/virtio_pci_common.c: In function ‘vp_del_vqs’:
    drivers/virtio/virtio_pci_common.c:257:29: warning: the comparison will always evaluate as ‘true’ for the pointer operand in ‘vp_dev->msix_affinity_masks + (sizetype)((long unsigned int)i * 256)’ must not be NULL [-Waddress]
      257 |                         if (vp_dev->msix_affinity_masks[i])
          |                             ^~~~~~

In fact, the verification is comparing the result of a pointer
arithmetic, the address "msix_affinity_masks + i", which will always
evaluate to true.

Under the hood, free_cpumask_var() calls kfree(), which is safe to pass
NULL, not requiring non-null verification.  So remove the verification
to make compiler happy (happy compiler, happy life).

[0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102103



Signed-off-by: default avatarMurilo Opsfelder Araujo <muriloo@linux.ibm.com>

This is to fix build failure when we enable -Werror. It's not yet merged, but
ACKed.
Link: https://lore.kernel.org/lkml/20220415023002.49805-1-muriloo@linux.ibm.com/



Signed-off-by: default avatarHe Zhe <zhe.he@windriver.com>
Signed-off-by: default avatarBruce Ashfield <bruce.ashfield@gmail.com>
parent a44e7133
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment