Re: [PATCH resend v3 1/4] usb: usbip tool: Check the return of get_nports()

2017-05-19 Thread Shuah Khan
On 05/19/2017 12:46 AM, Yuyang Du wrote:
> On Thu, May 18, 2017 at 03:53:04PM +0300, Sergei Shtylyov wrote:
>>> +   if (vhci_driver->nports <=0) {
>>
>>Please add a space after <= too.
> 
> Indeed. Thanks.
> 
> Hi Greg,
> 
> Do you want me to send another version to fix this?
> 

Yes. Please resend fixing this. I am surprised checkpatch.pl
didn't catch it!

thanks,
-- Shuah

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH resend v3 1/4] usb: usbip tool: Check the return of get_nports()

2017-05-19 Thread Yuyang Du
On Thu, May 18, 2017 at 03:53:04PM +0300, Sergei Shtylyov wrote:
> >+if (vhci_driver->nports <=0) {
> 
>Please add a space after <= too.

Indeed. Thanks.

Hi Greg,

Do you want me to send another version to fix this?

Thanks,
Yuyang
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH resend v3 1/4] usb: usbip tool: Check the return of get_nports()

2017-05-18 Thread Yuyang Du
On Thu, May 18, 2017 at 03:53:04PM +0300, Sergei Shtylyov wrote:
> >From: Yuyang Du 
> >
> >If we get nonpositive number of ports, there is no sense to
> 
>Negative?

Negative and zero.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH resend v3 1/4] usb: usbip tool: Check the return of get_nports()

2017-05-18 Thread Sergei Shtylyov

Hello!

On 05/18/2017 12:50 PM, Yuyang Du wrote:


From: Yuyang Du 

If we get nonpositive number of ports, there is no sense to


   Negative?


continue, then fail gracefully.

In addition, the commit 0775a9cbc694e8c72 ("usbip: vhci extension:
modifications to vhci driver") introduced configurable numbers of
controllers and ports, but we have a static port number maximum,
MAXNPORT. If exceeded, the idev array will be overflown. We fix
it by validating the nports to make sure the port number max is
not exceeded.

Reviewed-by: Krzysztof Opasiak 
Signed-off-by: Yuyang Du 
Acked-by: Shuah Khan 
---
 tools/usb/usbip/libsrc/vhci_driver.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/usb/usbip/libsrc/vhci_driver.c 
b/tools/usb/usbip/libsrc/vhci_driver.c
index f659c14..151580a 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.c
+++ b/tools/usb/usbip/libsrc/vhci_driver.c
@@ -220,9 +220,17 @@ int usbip_vhci_driver_open(void)
}

vhci_driver->nports = get_nports();
-
dbg("available ports: %d", vhci_driver->nports);

+   if (vhci_driver->nports <=0) {


   Please add a space after <= too.

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html