All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: f_mass_storage: Remove the LUN check which is always true
@ 2011-05-04 14:16 Maxin John
  2011-05-04 14:27 ` Michal Nazarewicz
  0 siblings, 1 reply; 9+ messages in thread
From: Maxin John @ 2011-05-04 14:16 UTC (permalink / raw)
  To: m.nazarewicz
  Cc: gregkh, stern, mina86, m-sonasath, linux-usb, linux-kernel,
	roger.quadros

Hi,

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>
---
diff --git a/drivers/usb/gadget/f_mass_storage.c
b/drivers/usb/gadget/f_mass_storage.c
index 6d8e533..cade79e 100644
--- 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) {

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-05-08 11:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-04 14:16 [PATCH] usb: gadget: f_mass_storage: Remove the LUN check which is always true Maxin John
2011-05-04 14:27 ` Michal Nazarewicz
2011-05-04 15:04   ` Maxin John
2011-05-04 15:41     ` Michal Nazarewicz
2011-05-04 16:02     ` Alan Stern
2011-05-07  1:09     ` Greg KH
2011-05-07  9:27       ` Maxin John
2011-05-07 15:43         ` Greg KH
2011-05-08 11:51           ` Maxin John

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.