From: Johannes Thumshirn <morbidrsa@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Stern <stern@rowland.harvard.edu>,
Sarah Sharp <sarah.a.sharp@linux.intel.com>,
Lan Tianyu <tianyu.lan@intel.com>,
Xenia Ragiadakou <burzalodowa@gmail.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Johannes Thumshirn <morbidrsa@gmail.com>
Subject: [PATCH] usb: hub: avoid possible division by zero
Date: Sat, 23 Nov 2013 17:31:34 +0100 [thread overview]
Message-ID: <1385224294-15461-1-git-send-email-morbidrsa@gmail.com> (raw)
Avoid possible division by zero in led_work, if hdev->maxchild is 0.
See also:
http://buildbot.llvm.linuxfoundation.org/checker/scan-build-latest/report-b65939.html#EndPath
Signed-off-by: Johannes Thumshirn <morbidrsa@gmail.com>
---
drivers/usb/core/hub.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a7c04e2..8c7aa4e 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -453,7 +453,8 @@ static void led_work (struct work_struct *work)
unsigned changed = 0;
int cursor = -1;
- if (hdev->state != USB_STATE_CONFIGURED || hub->quiescing)
+ if (hdev->state != USB_STATE_CONFIGURED || hub->quiescing
+ || hdev->maxchild == 0)
return;
for (i = 0; i < hdev->maxchild; i++) {
--
1.8.4.3
next reply other threads:[~2013-11-23 16:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-23 16:31 Johannes Thumshirn [this message]
2013-11-23 17:20 ` [PATCH] usb: hub: avoid possible division by zero Greg Kroah-Hartman
2013-11-23 17:26 ` Johannes Thumshirn
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=1385224294-15461-1-git-send-email-morbidrsa@gmail.com \
--to=morbidrsa@gmail.com \
--cc=burzalodowa@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sarah.a.sharp@linux.intel.com \
--cc=stern@rowland.harvard.edu \
--cc=tianyu.lan@intel.com \
/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