summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarc Gonzalez <marc_gonzalez@sigmadesigns.com>2017-04-10 19:46:54 +0200
committerBjorn Helgaas <bhelgaas@google.com>2017-04-18 14:11:10 -0500
commitdc5205ef46231e848562c9275933d7b359f515ba (patch)
treeb0104e99320fd7a22972067ca9a40ea00f7c79dc /drivers
parentfe2bd75b2290bf6acd4b91312697e445668dd773 (diff)
PCI: Improve __pci_read_base() robustness
Local variables 'l' and 'sz' are uninitialized. Normally, they would be initialized by pci_read_config_dword() but when an error occurs, some drivers immediately return an error code, which leaves the argument uninitialized. Provide a safe initial value to make the code more robust. Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/probe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index dfc9a2794141..f2bd0024cb88 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -175,7 +175,7 @@ static inline unsigned long decode_bar(struct pci_dev *dev, u32 bar)
int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
struct resource *res, unsigned int pos)
{
- u32 l, sz, mask;
+ u32 l = 0, sz = 0, mask;
u64 l64, sz64, mask64;
u16 orig_cmd;
struct pci_bus_region region, inverted_region;