Skip to content

Commit

Permalink
PCI/AER: Queue one GHES event, not several uninitialized ones
Browse files Browse the repository at this point in the history
ecae65e ("PCI/AER: Use kfifo_in_spinlocked() to insert locked
elements") replaced kfifo_put() with kfifo_in_spinlocked(), but passed the
*size* of the queue entry, where kfifo_in_spinlocked() expects the *number*
of entries to be copied.

We want to insert only one element into kfifo, not "sizeof(entry) = 16".
Without this patch, we would get 15 uninitialized elements.

Fixes: ecae65e ("PCI/AER: Use kfifo_in_spinlocked() to insert locked elements")
Signed-off-by: Yanjiang Jin <yanjiang.jin@hxt-semitech.com>
[bhelgaas: changelog]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
  • Loading branch information
Yanjiang Jin authored and Bjorn Helgaas committed Dec 14, 2018
1 parent b07b864 commit 1063a51
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pci/pcie/aer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
.regs = aer_regs,
};

if (kfifo_in_spinlocked(&aer_recover_ring, &entry, sizeof(entry),
if (kfifo_in_spinlocked(&aer_recover_ring, &entry, 1,
&aer_recover_ring_lock))
schedule_work(&aer_recover_work);
else
Expand Down

0 comments on commit 1063a51

Please sign in to comment.