* [U-Boot] [PATCH] usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()
@ 2017-09-28 4:50 Bin Meng
2017-09-28 15:24 ` Marek Vasut
0 siblings, 1 reply; 8+ messages in thread
From: Bin Meng @ 2017-09-28 4:50 UTC (permalink / raw)
To: u-boot
The stored 'blk' value is overwritten to 'size / 512' before it can
be used in usb_stor_set_max_xfer_blk(). This is not what we want.
In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
should simply assign 'size' to the upper limit.
Reported-by: Coverity (CID: 167250)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
common/usb_storage.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/usb_storage.c b/common/usb_storage.c
index a57570b..a91b1c0 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -964,7 +964,7 @@ static void usb_stor_set_max_xfer_blk(struct usb_device *udev,
blk = 20;
} else {
if (size > USHRT_MAX * 512)
- blk = USHRT_MAX;
+ size = USHRT_MAX * 512;
blk = size / 512;
}
#endif
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()
2017-09-28 4:50 [U-Boot] [PATCH] usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk() Bin Meng
@ 2017-09-28 15:24 ` Marek Vasut
2017-09-28 23:36 ` Bin Meng
0 siblings, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2017-09-28 15:24 UTC (permalink / raw)
To: u-boot
On 09/28/2017 06:50 AM, Bin Meng wrote:
> The stored 'blk' value is overwritten to 'size / 512' before it can
> be used in usb_stor_set_max_xfer_blk(). This is not what we want.
> In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
> should simply assign 'size' to the upper limit.
>
> Reported-by: Coverity (CID: 167250)
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Still failing
https://travis-ci.org/marex/u-boot-usb/builds/280835848
> ---
>
> common/usb_storage.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/usb_storage.c b/common/usb_storage.c
> index a57570b..a91b1c0 100644
> --- a/common/usb_storage.c
> +++ b/common/usb_storage.c
> @@ -964,7 +964,7 @@ static void usb_stor_set_max_xfer_blk(struct usb_device *udev,
> blk = 20;
> } else {
> if (size > USHRT_MAX * 512)
> - blk = USHRT_MAX;
> + size = USHRT_MAX * 512;
> blk = size / 512;
> }
> #endif
>
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()
2017-09-28 15:24 ` Marek Vasut
@ 2017-09-28 23:36 ` Bin Meng
2017-09-29 2:30 ` Marek Vasut
0 siblings, 1 reply; 8+ messages in thread
From: Bin Meng @ 2017-09-28 23:36 UTC (permalink / raw)
To: u-boot
Hi Marek,
On Thu, Sep 28, 2017 at 11:24 PM, Marek Vasut <marex@denx.de> wrote:
> On 09/28/2017 06:50 AM, Bin Meng wrote:
>> The stored 'blk' value is overwritten to 'size / 512' before it can
>> be used in usb_stor_set_max_xfer_blk(). This is not what we want.
>> In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
>> should simply assign 'size' to the upper limit.
>>
>> Reported-by: Coverity (CID: 167250)
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> Still failing
> https://travis-ci.org/marex/u-boot-usb/builds/280835848
>
This fixes the Coverity issue, not the 'make tests' issue. Please hold
on apply the xHCI patchset and when the fix is ready I will send v2.
>> ---
>>
>> common/usb_storage.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/common/usb_storage.c b/common/usb_storage.c
>> index a57570b..a91b1c0 100644
>> --- a/common/usb_storage.c
>> +++ b/common/usb_storage.c
>> @@ -964,7 +964,7 @@ static void usb_stor_set_max_xfer_blk(struct usb_device *udev,
>> blk = 20;
>> } else {
>> if (size > USHRT_MAX * 512)
>> - blk = USHRT_MAX;
>> + size = USHRT_MAX * 512;
>> blk = size / 512;
>> }
>> #endif
>>
Regards,
Bin
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()
2017-09-28 23:36 ` Bin Meng
@ 2017-09-29 2:30 ` Marek Vasut
2017-09-29 9:26 ` Bin Meng
0 siblings, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2017-09-29 2:30 UTC (permalink / raw)
To: u-boot
On 09/29/2017 01:36 AM, Bin Meng wrote:
> Hi Marek,
>
> On Thu, Sep 28, 2017 at 11:24 PM, Marek Vasut <marex@denx.de> wrote:
>> On 09/28/2017 06:50 AM, Bin Meng wrote:
>>> The stored 'blk' value is overwritten to 'size / 512' before it can
>>> be used in usb_stor_set_max_xfer_blk(). This is not what we want.
>>> In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
>>> should simply assign 'size' to the upper limit.
>>>
>>> Reported-by: Coverity (CID: 167250)
>>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>
>> Still failing
>> https://travis-ci.org/marex/u-boot-usb/builds/280835848
>>
>
> This fixes the Coverity issue, not the 'make tests' issue. Please hold
> on apply the xHCI patchset and when the fix is ready I will send v2.
Can't you send me fix on top of current set ? If not, OK, tell me what
to drop and what to pick.
Thanks
>>> ---
>>>
>>> common/usb_storage.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/common/usb_storage.c b/common/usb_storage.c
>>> index a57570b..a91b1c0 100644
>>> --- a/common/usb_storage.c
>>> +++ b/common/usb_storage.c
>>> @@ -964,7 +964,7 @@ static void usb_stor_set_max_xfer_blk(struct usb_device *udev,
>>> blk = 20;
>>> } else {
>>> if (size > USHRT_MAX * 512)
>>> - blk = USHRT_MAX;
>>> + size = USHRT_MAX * 512;
>>> blk = size / 512;
>>> }
>>> #endif
>>>
>
> Regards,
> Bin
>
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()
2017-09-29 2:30 ` Marek Vasut
@ 2017-09-29 9:26 ` Bin Meng
2017-09-29 9:36 ` Marek Vasut
0 siblings, 1 reply; 8+ messages in thread
From: Bin Meng @ 2017-09-29 9:26 UTC (permalink / raw)
To: u-boot
Hi Marek,
On Fri, Sep 29, 2017 at 10:30 AM, Marek Vasut <marex@denx.de> wrote:
> On 09/29/2017 01:36 AM, Bin Meng wrote:
>> Hi Marek,
>>
>> On Thu, Sep 28, 2017 at 11:24 PM, Marek Vasut <marex@denx.de> wrote:
>>> On 09/28/2017 06:50 AM, Bin Meng wrote:
>>>> The stored 'blk' value is overwritten to 'size / 512' before it can
>>>> be used in usb_stor_set_max_xfer_blk(). This is not what we want.
>>>> In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
>>>> should simply assign 'size' to the upper limit.
>>>>
>>>> Reported-by: Coverity (CID: 167250)
>>>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>>
>>> Still failing
>>> https://travis-ci.org/marex/u-boot-usb/builds/280835848
>>>
>>
>> This fixes the Coverity issue, not the 'make tests' issue. Please hold
>> on apply the xHCI patchset and when the fix is ready I will send v2.
>
> Can't you send me fix on top of current set ? If not, OK, tell me what
> to drop and what to pick.
>
OK, will do.
Regards,
Bin
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()
2017-09-29 9:26 ` Bin Meng
@ 2017-09-29 9:36 ` Marek Vasut
2017-10-01 13:18 ` Bin Meng
0 siblings, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2017-09-29 9:36 UTC (permalink / raw)
To: u-boot
On 09/29/2017 11:26 AM, Bin Meng wrote:
> Hi Marek,
>
> On Fri, Sep 29, 2017 at 10:30 AM, Marek Vasut <marex@denx.de> wrote:
>> On 09/29/2017 01:36 AM, Bin Meng wrote:
>>> Hi Marek,
>>>
>>> On Thu, Sep 28, 2017 at 11:24 PM, Marek Vasut <marex@denx.de> wrote:
>>>> On 09/28/2017 06:50 AM, Bin Meng wrote:
>>>>> The stored 'blk' value is overwritten to 'size / 512' before it can
>>>>> be used in usb_stor_set_max_xfer_blk(). This is not what we want.
>>>>> In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
>>>>> should simply assign 'size' to the upper limit.
>>>>>
>>>>> Reported-by: Coverity (CID: 167250)
>>>>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>>>
>>>> Still failing
>>>> https://travis-ci.org/marex/u-boot-usb/builds/280835848
>>>>
>>>
>>> This fixes the Coverity issue, not the 'make tests' issue. Please hold
>>> on apply the xHCI patchset and when the fix is ready I will send v2.
>>
>> Can't you send me fix on top of current set ? If not, OK, tell me what
>> to drop and what to pick.
>>
>
> OK, will do.
Thanks!
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()
2017-09-29 9:36 ` Marek Vasut
@ 2017-10-01 13:18 ` Bin Meng
2017-10-01 18:41 ` Marek Vasut
0 siblings, 1 reply; 8+ messages in thread
From: Bin Meng @ 2017-10-01 13:18 UTC (permalink / raw)
To: u-boot
Hi Marek,
On Fri, Sep 29, 2017 at 5:36 PM, Marek Vasut <marex@denx.de> wrote:
> On 09/29/2017 11:26 AM, Bin Meng wrote:
>> Hi Marek,
>>
>> On Fri, Sep 29, 2017 at 10:30 AM, Marek Vasut <marex@denx.de> wrote:
>>> On 09/29/2017 01:36 AM, Bin Meng wrote:
>>>> Hi Marek,
>>>>
>>>> On Thu, Sep 28, 2017 at 11:24 PM, Marek Vasut <marex@denx.de> wrote:
>>>>> On 09/28/2017 06:50 AM, Bin Meng wrote:
>>>>>> The stored 'blk' value is overwritten to 'size / 512' before it can
>>>>>> be used in usb_stor_set_max_xfer_blk(). This is not what we want.
>>>>>> In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
>>>>>> should simply assign 'size' to the upper limit.
>>>>>>
>>>>>> Reported-by: Coverity (CID: 167250)
>>>>>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>>>>
>>>>> Still failing
>>>>> https://travis-ci.org/marex/u-boot-usb/builds/280835848
>>>>>
>>>>
>>>> This fixes the Coverity issue, not the 'make tests' issue. Please hold
>>>> on apply the xHCI patchset and when the fix is ready I will send v2.
>>>
>>> Can't you send me fix on top of current set ? If not, OK, tell me what
>>> to drop and what to pick.
>>>
>>
>> OK, will do.
>
> Thanks!
>
I just sent additional patches
(http://patchwork.ozlabs.org/project/uboot/list/?series=5892) to fix
the 'make tests' issues.
Please do the following on the u-boot-usb/master branch:
1). Drop http://git.denx.de/?p=u-boot/u-boot-usb.git;a=commit;h=198db64035a589ef19920b2cec58419b4b338ce7
2). Drop http://git.denx.de/?p=u-boot/u-boot-usb.git;a=commit;h=9a462a3af216d77fee689f119419506218531f77
3). Apply http://patchwork.ozlabs.org/project/uboot/list/?series=5892
on top of u-boot-usb/master
Then everything should be fine.
Regards,
Bin
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()
2017-10-01 13:18 ` Bin Meng
@ 2017-10-01 18:41 ` Marek Vasut
0 siblings, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2017-10-01 18:41 UTC (permalink / raw)
To: u-boot
On 10/01/2017 03:18 PM, Bin Meng wrote:
> Hi Marek,
>
> On Fri, Sep 29, 2017 at 5:36 PM, Marek Vasut <marex@denx.de> wrote:
>> On 09/29/2017 11:26 AM, Bin Meng wrote:
>>> Hi Marek,
>>>
>>> On Fri, Sep 29, 2017 at 10:30 AM, Marek Vasut <marex@denx.de> wrote:
>>>> On 09/29/2017 01:36 AM, Bin Meng wrote:
>>>>> Hi Marek,
>>>>>
>>>>> On Thu, Sep 28, 2017 at 11:24 PM, Marek Vasut <marex@denx.de> wrote:
>>>>>> On 09/28/2017 06:50 AM, Bin Meng wrote:
>>>>>>> The stored 'blk' value is overwritten to 'size / 512' before it can
>>>>>>> be used in usb_stor_set_max_xfer_blk(). This is not what we want.
>>>>>>> In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
>>>>>>> should simply assign 'size' to the upper limit.
>>>>>>>
>>>>>>> Reported-by: Coverity (CID: 167250)
>>>>>>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>>>>>
>>>>>> Still failing
>>>>>> https://travis-ci.org/marex/u-boot-usb/builds/280835848
>>>>>>
>>>>>
>>>>> This fixes the Coverity issue, not the 'make tests' issue. Please hold
>>>>> on apply the xHCI patchset and when the fix is ready I will send v2.
>>>>
>>>> Can't you send me fix on top of current set ? If not, OK, tell me what
>>>> to drop and what to pick.
>>>>
>>>
>>> OK, will do.
>>
>> Thanks!
>>
>
> I just sent additional patches
> (http://patchwork.ozlabs.org/project/uboot/list/?series=5892) to fix
> the 'make tests' issues.
>
> Please do the following on the u-boot-usb/master branch:
>
> 1). Drop http://git.denx.de/?p=u-boot/u-boot-usb.git;a=commit;h=198db64035a589ef19920b2cec58419b4b338ce7
> 2). Drop http://git.denx.de/?p=u-boot/u-boot-usb.git;a=commit;h=9a462a3af216d77fee689f119419506218531f77
> 3). Apply http://patchwork.ozlabs.org/project/uboot/list/?series=5892
> on top of u-boot-usb/master
>
> Then everything should be fine.
Build tests pass, PR out, thanks !
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-10-01 18:41 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-28 4:50 [U-Boot] [PATCH] usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk() Bin Meng
2017-09-28 15:24 ` Marek Vasut
2017-09-28 23:36 ` Bin Meng
2017-09-29 2:30 ` Marek Vasut
2017-09-29 9:26 ` Bin Meng
2017-09-29 9:36 ` Marek Vasut
2017-10-01 13:18 ` Bin Meng
2017-10-01 18:41 ` Marek Vasut
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.