Skip to content

Commit c9ad266

Browse files
habetsm-xilinxkuba-moo
authored andcommitted
sfc: Avoid NULL pointer dereference on systems without numa awareness
On such systems cpumask_of_node() returns NULL, which bitmap operations are not happy with. Fixes: c265b56 ("sfc: default config to 1 channel/core in local NUMA node only") Fixes: 09a99ab ("sfc: set affinity hints in local NUMA node only") Signed-off-by: Martin Habets <[email protected]> Reviewed-by: Íñigo Huguet <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8f0588e commit c9ad266

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

drivers/net/ethernet/sfc/efx_channels.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,9 @@ static unsigned int count_online_cores(struct efx_nic *efx, bool local_node)
9191
}
9292

9393
cpumask_copy(filter_mask, cpu_online_mask);
94-
if (local_node) {
95-
int numa_node = pcibus_to_node(efx->pci_dev->bus);
96-
97-
cpumask_and(filter_mask, filter_mask, cpumask_of_node(numa_node));
98-
}
94+
if (local_node)
95+
cpumask_and(filter_mask, filter_mask,
96+
cpumask_of_pcibus(efx->pci_dev->bus));
9997

10098
count = 0;
10199
for_each_cpu(cpu, filter_mask) {
@@ -386,8 +384,7 @@ int efx_probe_interrupts(struct efx_nic *efx)
386384
#if defined(CONFIG_SMP)
387385
void efx_set_interrupt_affinity(struct efx_nic *efx)
388386
{
389-
int numa_node = pcibus_to_node(efx->pci_dev->bus);
390-
const struct cpumask *numa_mask = cpumask_of_node(numa_node);
387+
const struct cpumask *numa_mask = cpumask_of_pcibus(efx->pci_dev->bus);
391388
struct efx_channel *channel;
392389
unsigned int cpu;
393390

0 commit comments

Comments
 (0)