Re: [patch v6 3/7] genirq/affinity: Add new callback for (re)calculating interrupt sets

From: Thomas Gleixner
Date: Fri Jun 18 2021 - 15:19:24 EST


On Tue, Jun 15 2021 at 14:57, Bjorn Helgaas wrote:
>
>> @@ -1196,6 +1196,13 @@ int pci_alloc_irq_vectors_affinity(struc
>> /* use legacy irq if allowed */
>> if (flags & PCI_IRQ_LEGACY) {
>> if (min_vecs == 1 && dev->irq) {
>> + /*
>> + * Invoke the affinity spreading logic to ensure that
>> + * the device driver can adjust queue configuration
>> + * for the single interrupt case.
>> + */
>> + if (affd)
>> + irq_create_affinity_masks(1, affd);
>
> This looks like a leak because irq_create_affinity_masks() returns a
> pointer to kcalloc()ed space, but we throw away the pointer.
>
> Or is there something very subtle going on here, like this special
> case doesn't allocate anything? I do see the "Nothing to assign?"
> case that returns NULL with no alloc, but it's not completely trivial
> to verify that we take that case here.

Yes, it's subtle and it's subtle crap. Sorry that I did not catch that.

Thanks,

tglx