[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220414150855.2407137-4-dinechin@redhat.com>
Date: Thu, 14 Apr 2022 17:08:55 +0200
From: Christophe de Dinechin <dinechin@...hat.com>
To: trivial@...nel.org
Cc: Ben Segall <bsegall@...gle.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>, Mel Gorman <mgorman@...e.de>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Jason Wang <jasowang@...hat.com>,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org,
Zhen Lei <thunder.leizhen@...wei.com>,
Christophe de Dinechin <dinechin@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>,
Peter Zijlstra <peterz@...radead.org>
Subject: [PATCH 3/3] virtio-pci: Use cpumask_available to fix compilation error
With GCC 12 and defconfig, we get the following error:
| CC drivers/virtio/virtio_pci_common.o
| drivers/virtio/virtio_pci_common.c: In function ‘vp_del_vqs’:
| drivers/virtio/virtio_pci_common.c:257:29: error: the comparison will
| always evaluate as ‘true’ for the pointer operand in
| ‘vp_dev->msix_affinity_masks + (sizetype)((long unsigned int)i * 8)’
| must not be NULL [-Werror=address]
| 257 | if (vp_dev->msix_affinity_masks[i])
| | ^~~~~~
This happens in the case where CONFIG_CPUMASK_OFFSTACK is not defined,
since we typedef cpumask_var_t as an array. The compiler is essentially
complaining that an array pointer cannot be NULL. This is not a very
important warning, but there is a function called cpumask_available that
seems to be defined just for that case, so the fix is easy.
Signed-off-by: Christophe de Dinechin <christophe@...echin.org>
Signed-off-by: Christophe de Dinechin <dinechin@...hat.com>
---
drivers/virtio/virtio_pci_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
index d724f676608b..5c44a2f13c93 100644
--- a/drivers/virtio/virtio_pci_common.c
+++ b/drivers/virtio/virtio_pci_common.c
@@ -254,7 +254,7 @@ void vp_del_vqs(struct virtio_device *vdev)
if (vp_dev->msix_affinity_masks) {
for (i = 0; i < vp_dev->msix_vectors; i++)
- if (vp_dev->msix_affinity_masks[i])
+ if (cpumask_available(vp_dev->msix_affinity_masks[i]))
free_cpumask_var(vp_dev->msix_affinity_masks[i]);
}
--
2.35.1
Powered by blists - more mailing lists