2011/10/18 Michal Nazarewicz <mina86@xxxxxxxxxx>: >>> On Mon, 17 Oct 2011, Yuping Luo wrote: >>>> >>>> @@ -2249,6 +2250,18 @@ static int check_command(struct fsg_dev *fsg, >>>> int cmnd_size, >>>> } else >>>> cmnd_size = 12; >>>> >>>> + curlun = fsg->curlun; >>>> + /* Convert the data size's unit from CDB */ >>>> + if (fsg->data_size_is_in_blocks == 1) { >>>> + fsg->data_size_is_in_blocks = 0; >>>> + if (!curlun) { >>>> + DBG(fsg, "curlun NULL\n"); >>>> + return -EINVAL; >>>> + } > >> On Tue, Oct 18, 2011 at 12:20 AM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> >> wrote: >>> >>> Neither the debug message nor the return is needed. Just reverse the >>> sense of the test, and ... > > On Mon, 17 Oct 2011 19:37:37 -0700, Yuping Luo <lypingsh@xxxxxxxxx> wrote: >> >> if enter !curlun case, something is wrong in the incoming packet, the >> data_size_from_cmnd is uncertain. correct ? > > !curlun case is checked later on though, right? > yes, however, you didn't answer my second concern, or I have to put the following code about data_size_from_cmnd under if (curlun) clause, which may make the code not so nice. >>>> + fsg->data_size_from_cmnd = >>>> + fsg->data_size_from_cmnd << curlun->blkbits; >>> >>> ... use a compound assignment operator: >>> >> ok, will change. >>> >>> if (curlun) >>> fsg->data_size_from_cmnd <<= curlun->blkbits; >>> > > -- > Best regards, _ _ > .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o > ..o | Computer Science, Michał “mina86” Nazarewicz (o o) > ooo +----<email/xmpp: mpn@xxxxxxxxxx>--------------ooO--(_)--Ooo-- > Yuping Luo -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html