RE: [PATCH] hv: Remove unnecessary comparison of unsigned against 0

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

 




> -----Original Message-----
> From: Tobias Klauser [mailto:tklauser@xxxxxxxxxx]
> Sent: Friday, April 25, 2014 8:04 AM
> To: KY Srinivasan; Haiyang Zhang
> Cc: devel@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [PATCH] hv: Remove unnecessary comparison of unsigned against 0
> 
> pfncount is of type u32 and thus can never be smaller than 0.
> 
> Found by the coverity scanner, CID 143213.
> 
> Signed-off-by: Tobias Klauser <tklauser@xxxxxxxxxx>

Thanks Tobias.
Signed-off-by: K. Y. Srinivasan <kys@xxxxxxxxxxxxx>

> ---
>  drivers/hv/channel.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index
> 602ca86..17c8689 100644
> --- a/drivers/hv/channel.c
> +++ b/drivers/hv/channel.c
> @@ -674,8 +674,7 @@ int vmbus_sendpacket_multipagebuffer(struct
> vmbus_channel *channel,
>  	u32 pfncount = NUM_PAGES_SPANNED(multi_pagebuffer->offset,
>  					 multi_pagebuffer->len);
> 
> -
> -	if ((pfncount < 0) || (pfncount >
> MAX_MULTIPAGE_BUFFER_COUNT))
> +	if (pfncount > MAX_MULTIPAGE_BUFFER_COUNT)
>  		return -EINVAL;
> 
>  	/*
> --
> 1.7.9.5
> 

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux