[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220521073848.4052-1-gautam.linuxkernel@gmail.com>
Date: Sat, 21 May 2022 00:38:48 -0700
From: Gautam Menghani <gautam.linuxkernel@...il.com>
To: airlied@...ux.ie
Cc: Gautam Menghani <gautam.linuxkernel@...il.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH] drivers/char/agp: Fix divide by zero warning in isoch.c
Add a check to ensure ndevs is not zero. This was found by clang scan
warning: Division by zero [core.DivideZero]
mrq = trq / ndevs;
Signed-off-by: Gautam Menghani <gautam.linuxkernel@...il.com>
---
drivers/char/agp/isoch.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/char/agp/isoch.c b/drivers/char/agp/isoch.c
index 7ecf20a6d19c..da0d2681225b 100644
--- a/drivers/char/agp/isoch.c
+++ b/drivers/char/agp/isoch.c
@@ -289,6 +289,9 @@ static void agp_3_5_nonisochronous_node_enable(struct agp_bridge_data *bridge,
u32 trq, mrq, rem;
unsigned int cdev = 0;
+ if (ndevs == 0)
+ return;
+
pci_read_config_dword(bridge->dev, bridge->capndx+AGPSTAT, &tstatus);
trq = (tstatus >> 24) & 0xff;
--
2.25.1
Powered by blists - more mailing lists