Re: ehci tests unsigned variables against 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 21 April 2008, Matthew Wilcox wrote:
> > -ENOPATCH
> 
> Yeah ... I didn't bother with one.  Let's try now:

If you send this as a proper patch to linux-usb@vger,
you can add

Acked-by: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>

> 
> diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
> index 64ebfc5..55a2c73 100644
> --- a/drivers/usb/host/ehci-dbg.c
> +++ b/drivers/usb/host/ehci-dbg.c
> @@ -454,9 +454,7 @@ static void qh_lines (
>  				(scratch >> 16) & 0x7fff,
>  				scratch,
>  				td->urb);
> -		if (temp < 0)
> -			temp = 0;
> -		else if (size < temp)
> +		if (size < temp)
>  			temp = size;
>  		size -= temp;
>  		next += temp;
> @@ -465,9 +463,7 @@ static void qh_lines (
>  	}
>  
>  	temp = snprintf (next, size, "\n");
> -	if (temp < 0)
> -		temp = 0;
> -	else if (size < temp)
> +	if (size < temp)
>  		temp = size;
>  	size -= temp;
>  	next += temp;
> 
> > ... although if that's the case, I'd think that the *snprintf()
> > signatures are incorrect:  they should return "unsigned" not "int".
> > If that were done, I think even GCC could be made to report such
> > issues; one wouldn't need less-common tools like coccinelle.
> 
> We can take it up with ANSI, but I'm not sure they'll be interested in
> changing the return type of snprintf ...

I don't care so much about ANSI as about <linux/kernel.h>,
at least in this context...

- Dave
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux