[PATCH] piix: Fix uninitialized use in piix_check_450nx()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Inside the function piix_check_450nx(), variable "cfg" could be
uninitialized if pci_bus_read_config_word() returns
PCIBIOS_BAD_REGISTER_NUMBER. However, it is directly used in the
if statement, which is potentially unsafe.

Signed-off-by: Yizhuo <yzhai003@xxxxxxx>
---
 drivers/ide/piix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ide/piix.c b/drivers/ide/piix.c
index a671cead6ae7..e01266c6cbbc 100644
--- a/drivers/ide/piix.c
+++ b/drivers/ide/piix.c
@@ -397,7 +397,7 @@ static int piix_init_one(struct pci_dev *dev,
const struct pci_device_id *id)
 static void piix_check_450nx(void)
 {
        struct pci_dev *pdev = NULL;
-       u16 cfg;
+       u16 cfg = ~0;
        while((pdev=pci_get_device(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_82454NX, pdev))!=NULL)
        {
                /* Look for 450NX PXB. Check for problem configurations
-- 
2.31.1



[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux