* [PATCH] piix: Fix uninitialized use in piix_check_450nx()
@ 2021-04-19 16:43 Yizhuo Zhai
0 siblings, 0 replies; only message in thread
From: Yizhuo Zhai @ 2021-04-19 16:43 UTC (permalink / raw)
To: David Miller, linux-ide
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@ucr.edu>
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-19 16:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19 16:43 [PATCH] piix: Fix uninitialized use in piix_check_450nx() Yizhuo Zhai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).