[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211209094556.2085357-1-jiasheng@iscas.ac.cn>
Date: Thu, 9 Dec 2021 17:45:56 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: ruscur@...sell.cc, oohall@...il.com, bhelgaas@...gle.com
Cc: linuxppc-dev@...ts.ozlabs.org, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] PCI/AER: potential dereference of null pointer
he return value of kzalloc() needs to be checked.
To avoid use of null pointer in case of the failure of alloc.
Fixes: db89ccbe52c7 ("PCI/AER: Define aer_stats structure for AER capable devices")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
drivers/pci/pcie/aer.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index ec943cee5ecc..d04303edf468 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -376,6 +376,8 @@ void pci_aer_init(struct pci_dev *dev)
return;
dev->aer_stats = kzalloc(sizeof(struct aer_stats), GFP_KERNEL);
+ if (!dev->aer_stats)
+ return;
/*
* We save/restore PCI_ERR_UNCOR_MASK, PCI_ERR_UNCOR_SEVER,
--
2.25.1
Powered by blists - more mailing lists