* [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
* Re: [PATCH] usb: gadget: f_mass_storage: Remove the LUN check which is always true
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
0 siblings, 1 reply; 9+ messages in thread
From: Michal Nazarewicz @ 2011-05-04 14:27 UTC (permalink / raw)
To: Maxin John
Cc: gregkh, stern, m-sonasath, linux-usb, linux-kernel, roger.quadros
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--
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_mass_storage: Remove the LUN check which is always true
2011-05-04 14:27 ` Michal Nazarewicz
@ 2011-05-04 15:04 ` Maxin John
2011-05-04 15:41 ` Michal Nazarewicz
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Maxin John @ 2011-05-04 15:04 UTC (permalink / raw)
To: Michal Nazarewicz
Cc: gregkh, stern, m-sonasath, linux-usb, linux-kernel, roger.quadros
Hi Michal,
> Acked-by: Michal Nazarewicz <mina86@mina86.com>
Thank you very much for reviewing the patch.
> file_storage.c has the same check, could you remove it as well.
Please find the patch for "file_storage.c" below. Should I merge these
two patches and re-submit as a single one?
Signed-off-by: Maxin B. John <maxin.john@gmail.com>
---
diff --git a/drivers/usb/gadget/file_storage.c
b/drivers/usb/gadget/file_storage.c
index a6eacb5..a9c5177 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -2314,7 +2314,7 @@ static int check_command(struct fsg_dev *fsg,
int cmnd_size,
fsg->lun = lun; // Use LUN from the command
/* Check the LUN */
- if (fsg->lun >= 0 && fsg->lun < fsg->nluns) {
+ if (fsg->lun < fsg->nluns) {
fsg->curlun = curlun = &fsg->luns[fsg->lun];
if (fsg->cmnd[0] != REQUEST_SENSE) {
curlun->sense_data = SS_NO_SENSE;
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_mass_storage: Remove the LUN check which is always true
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
2 siblings, 0 replies; 9+ messages in thread
From: Michal Nazarewicz @ 2011-05-04 15:41 UTC (permalink / raw)
To: Maxin John
Cc: gregkh, stern, m-sonasath, linux-usb, linux-kernel, roger.quadros
On Wed, 04 May 2011 17:04:03 +0200, Maxin John <maxin.john@gmail.com>
wrote:
> Hi Michal,
>
>> Acked-by: Michal Nazarewicz <mina86@mina86.com>
>
> Thank you very much for reviewing the patch.
>
>> file_storage.c has the same check, could you remove it as well.
>
> Please find the patch for "file_storage.c" below. Should I merge these
> two patches and re-submit as a single one?
I would merge them together.
> Signed-off-by: Maxin B. John <maxin.john@gmail.com>
> ---
> diff --git a/drivers/usb/gadget/file_storage.c
> b/drivers/usb/gadget/file_storage.c
> index a6eacb5..a9c5177 100644
> --- a/drivers/usb/gadget/file_storage.c
> +++ b/drivers/usb/gadget/file_storage.c
> @@ -2314,7 +2314,7 @@ static int check_command(struct fsg_dev *fsg,
> int cmnd_size,
> fsg->lun = lun; // Use LUN from the command
>
> /* Check the LUN */
> - if (fsg->lun >= 0 && fsg->lun < fsg->nluns) {
> + if (fsg->lun < fsg->nluns) {
> fsg->curlun = curlun = &fsg->luns[fsg->lun];
> if (fsg->cmnd[0] != REQUEST_SENSE) {
> curlun->sense_data = SS_NO_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--
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_mass_storage: Remove the LUN check which is always true
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
2 siblings, 0 replies; 9+ messages in thread
From: Alan Stern @ 2011-05-04 16:02 UTC (permalink / raw)
To: Maxin John
Cc: Michal Nazarewicz, gregkh, m-sonasath, linux-usb, linux-kernel,
roger.quadros
On Wed, 4 May 2011, Maxin John wrote:
> Hi Michal,
>
> > Acked-by: Michal Nazarewicz <mina86@mina86.com>
>
> Thank you very much for reviewing the patch.
>
> > file_storage.c has the same check, could you remove it as well.
>
> Please find the patch for "file_storage.c" below. Should I merge these
> two patches and re-submit as a single one?
>
> Signed-off-by: Maxin B. John <maxin.john@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
> ---
> diff --git a/drivers/usb/gadget/file_storage.c
> b/drivers/usb/gadget/file_storage.c
> index a6eacb5..a9c5177 100644
> --- a/drivers/usb/gadget/file_storage.c
> +++ b/drivers/usb/gadget/file_storage.c
> @@ -2314,7 +2314,7 @@ static int check_command(struct fsg_dev *fsg,
> int cmnd_size,
> fsg->lun = lun; // Use LUN from the command
>
> /* Check the LUN */
> - if (fsg->lun >= 0 && fsg->lun < fsg->nluns) {
> + if (fsg->lun < fsg->nluns) {
> fsg->curlun = curlun = &fsg->luns[fsg->lun];
> if (fsg->cmnd[0] != REQUEST_SENSE) {
> curlun->sense_data = SS_NO_SENSE;
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_mass_storage: Remove the LUN check which is always true
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
2 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2011-05-07 1:09 UTC (permalink / raw)
To: Maxin John
Cc: Michal Nazarewicz, gregkh, stern, m-sonasath, linux-usb,
linux-kernel, roger.quadros
On Wed, May 04, 2011 at 04:04:03PM +0100, Maxin John wrote:
> Hi Michal,
>
> > Acked-by: Michal Nazarewicz <mina86@mina86.com>
>
> Thank you very much for reviewing the patch.
>
> > file_storage.c has the same check, could you remove it as well.
>
> Please find the patch for "file_storage.c" below. Should I merge these
> two patches and re-submit as a single one?
Yes please.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_mass_storage: Remove the LUN check which is always true
2011-05-07 1:09 ` Greg KH
@ 2011-05-07 9:27 ` Maxin John
2011-05-07 15:43 ` Greg KH
0 siblings, 1 reply; 9+ messages in thread
From: Maxin John @ 2011-05-07 9:27 UTC (permalink / raw)
To: Greg KH
Cc: Michal Nazarewicz, gregkh, stern, m-sonasath, linux-usb,
linux-kernel, roger.quadros
Hi Greg,
>> Please find the patch for "file_storage.c" below. Should I merge these
>> two patches and re-submit as a single one?
>
> Yes please.
As per your suggestion, please find the merged patch below:
Signed-off-by: Maxin B. John <maxin.john@gmail.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
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) {
diff --git a/drivers/usb/gadget/file_storage.c
b/drivers/usb/gadget/file_storage.c
index a6eacb5..a9c5177 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -2314,7 +2314,7 @@ static int check_command(struct fsg_dev *fsg,
int cmnd_size,
fsg->lun = lun; // Use LUN from the command
/* Check the LUN */
- if (fsg->lun >= 0 && fsg->lun < fsg->nluns) {
+ if (fsg->lun < fsg->nluns) {
fsg->curlun = curlun = &fsg->luns[fsg->lun];
if (fsg->cmnd[0] != REQUEST_SENSE) {
curlun->sense_data = SS_NO_SENSE;
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_mass_storage: Remove the LUN check which is always true
2011-05-07 9:27 ` Maxin John
@ 2011-05-07 15:43 ` Greg KH
2011-05-08 11:51 ` Maxin John
0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2011-05-07 15:43 UTC (permalink / raw)
To: Maxin John
Cc: Michal Nazarewicz, gregkh, stern, m-sonasath, linux-usb,
linux-kernel, roger.quadros
On Sat, May 07, 2011 at 12:27:58PM +0300, Maxin John wrote:
> Hi Greg,
>
> >> Please find the patch for "file_storage.c" below. Should I merge these
> >> two patches and re-submit as a single one?
> >
> > Yes please.
>
> As per your suggestion, please find the merged patch below:
>
> Signed-off-by: Maxin B. John <maxin.john@gmail.com>
> Acked-by: Michal Nazarewicz <mina86@mina86.com>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
Ok, but you forgot a changelog entry and a good subject line.
Care to redo this in a format that I don't have to edit it in order to
be able to apply it properly?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_mass_storage: Remove the LUN check which is always true
2011-05-07 15:43 ` Greg KH
@ 2011-05-08 11:51 ` Maxin John
0 siblings, 0 replies; 9+ messages in thread
From: Maxin John @ 2011-05-08 11:51 UTC (permalink / raw)
To: Greg KH
Cc: Michal Nazarewicz, gregkh, stern, m-sonasath, linux-usb,
linux-kernel, roger.quadros
Hi Greg,
On Sat, May 7, 2011 at 6:43 PM, Greg KH <greg@kroah.com> wrote:
> On Sat, May 07, 2011 at 12:27:58PM +0300, Maxin John wrote:
>> Hi Greg,
>
> Ok, but you forgot a changelog entry and a good subject line.
Oh.. my mistake. I forgot to update it.. Sorry.
> Care to redo this in a format that I don't have to edit it in order to
> be able to apply it properly?
I think, I should blame Gmail for this. I have switched to "mutt" as
it seems to work fine for me now. I will re-send the merged patch based
on your suggestions.
Thanks,
Maxin
^ permalink raw reply [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.