Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1711929 > unrolled thread
| Started by | Colin King <colin.king@canonical.com> |
|---|---|
| First post | 2017-08-15 09:40 +0200 |
| Last post | 2017-08-15 16:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] usb: gadget: dummy: fix infinite loop because of missing loop decrement Colin King <colin.king@canonical.com> - 2017-08-15 09:40 +0200
Re: [PATCH] usb: gadget: dummy: fix infinite loop because of missing loop decrement Alan Stern <stern@rowland.harvard.edu> - 2017-08-15 16:00 +0200
| From | Colin King <colin.king@canonical.com> |
|---|---|
| Date | 2017-08-15 09:40 +0200 |
| Subject | [PATCH] usb: gadget: dummy: fix infinite loop because of missing loop decrement |
| Message-ID | <ueECd-6Oz-5@gated-at.bofh.it> |
From: Colin Ian King <colin.king@canonical.com>
The while loop never terminates because the loop counter i is never
decremented. Fix this by decrementing i.
Detected by CoverityScan, CID#751073 ("Infinite Loop")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/usb/gadget/udc/dummy_hcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
index 3c3760315910..a030d7923d7d 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -2776,7 +2776,7 @@ static int __init init(void)
if (retval < 0) {
i--;
while (i >= 0)
- platform_device_del(the_udc_pdev[i]);
+ platform_device_del(the_udc_pdev[i--]);
goto err_add_udc;
}
}
--
2.11.0
[toc] | [next] | [standalone]
| From | Alan Stern <stern@rowland.harvard.edu> |
|---|---|
| Date | 2017-08-15 16:00 +0200 |
| Subject | Re: [PATCH] usb: gadget: dummy: fix infinite loop because of missing loop decrement |
| Message-ID | <ueKxY-1YZ-27@gated-at.bofh.it> |
| In reply to | #1711929 |
On Tue, 15 Aug 2017, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The while loop never terminates because the loop counter i is never
> decremented. Fix this by decrementing i.
>
> Detected by CoverityScan, CID#751073 ("Infinite Loop")
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/usb/gadget/udc/dummy_hcd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
> index 3c3760315910..a030d7923d7d 100644
> --- a/drivers/usb/gadget/udc/dummy_hcd.c
> +++ b/drivers/usb/gadget/udc/dummy_hcd.c
> @@ -2776,7 +2776,7 @@ static int __init init(void)
> if (retval < 0) {
> i--;
> while (i >= 0)
> - platform_device_del(the_udc_pdev[i]);
> + platform_device_del(the_udc_pdev[i--]);
> goto err_add_udc;
> }
> }
Acked-by: Alan Stern <stern@rowland.harvard.edu>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web