[PATCH] USB: core: remove dead code in do_proc_bulk()

Rex Nie posted 1 patch 2 weeks, 1 day ago
There is a newer version of this series
drivers/usb/core/devio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] USB: core: remove dead code in do_proc_bulk()
Posted by Rex Nie 2 weeks, 1 day ago
Since len1 is unsigned int, len1 < 0 always false. Remove it keep code
simple.

Signed-off-by: Rex Nie <rex.nie@jaguarmicro.com>
---
 drivers/usb/core/devio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 3beb6a862e80..712e290bab04 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1295,7 +1295,7 @@ static int do_proc_bulk(struct usb_dev_state *ps,
 		return ret;
 
 	len1 = bulk->len;
-	if (len1 < 0 || len1 >= (INT_MAX - sizeof(struct urb)))
+	if (len1 >= (INT_MAX - sizeof(struct urb)))
 		return -EINVAL;
 
 	if (bulk->ep & USB_DIR_IN)
-- 
2.17.1
Re: [PATCH] USB: core: remove dead code in do_proc_bulk()
Posted by Alan Stern 2 weeks, 1 day ago
On Fri, Nov 08, 2024 at 05:42:55PM +0800, Rex Nie wrote:
> Since len1 is unsigned int, len1 < 0 always false. Remove it keep code
> simple.
> 
> Signed-off-by: Rex Nie <rex.nie@jaguarmicro.com>

Acked-by: Alan Stern <stern@rowland.harvard.edu>

> ---
>  drivers/usb/core/devio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index 3beb6a862e80..712e290bab04 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -1295,7 +1295,7 @@ static int do_proc_bulk(struct usb_dev_state *ps,
>  		return ret;
>  
>  	len1 = bulk->len;
> -	if (len1 < 0 || len1 >= (INT_MAX - sizeof(struct urb)))
> +	if (len1 >= (INT_MAX - sizeof(struct urb)))
>  		return -EINVAL;
>  
>  	if (bulk->ep & USB_DIR_IN)
> -- 
> 2.17.1
> 
>