From: Gautam Menghani <gautam.linuxkernel@gmail.com>
To: airlied@linux.ie
Cc: Gautam Menghani <gautam.linuxkernel@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] drivers/char/agp: Fix divide by zero warning in isoch.c
Date: Sat, 21 May 2022 00:38:48 -0700 [thread overview]
Message-ID: <20220521073848.4052-1-gautam.linuxkernel@gmail.com> (raw)
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@gmail.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
reply other threads:[~2022-05-21 7:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220521073848.4052-1-gautam.linuxkernel@gmail.com \
--to=gautam.linuxkernel@gmail.com \
--cc=airlied@linux.ie \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox