lkml.org 
[lkml]   [2013]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] usb: hub: avoid possible division by zero
Date
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


\
 
 \ /
  Last update: 2013-11-23 17:41    [W:0.055 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site