lkml.org 
[lkml]   [2011]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] usb: gadget: f_mass_storage: Remove the LUN check which is always true
Date
From
On Wed, 04 May 2011 16:16:05 +0200, Maxin John <maxin.john@gmail.com>  
wrote:
> Since comparing an unsigned int (common->lun) greater than or equal
> to zero is always true, I think it is safe to remove this check.
> Please let me know your comments.
>
> Thanks to Coverity for pointing this out.
>
> Signed-off-by: Maxin B. John <maxin.john@gmail.com>

Acked-by: Michal Nazarewicz <mina86@mina86.com>

file_storage.c has the same check, could you remove it as well.

> --- a/drivers/usb/gadget/f_mass_storage.c
> +++ b/drivers/usb/gadget/f_mass_storage.c
> @@ -1910,7 +1910,7 @@ static int check_command(struct fsg_common
> *common, int cmnd_size,
> common->lun, lun);
>
> /* Check the LUN */
> - if (common->lun >= 0 && common->lun < common->nluns) {
> + if (common->lun < common->nluns) {
> curlun = &common->luns[common->lun];
> common->curlun = curlun;
> if (common->cmnd[0] != REQUEST_SENSE) {


--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +-----<email/xmpp: mnazarewicz@google.com>-----ooO--(_)--Ooo--


\
 
 \ /
  Last update: 2011-05-04 16:29    [W:0.057 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site