Re: [PATCH] usb: misc: add a missing continue and refactor code

2017-02-21 Thread Gustavo A. R. Silva
Hi Alan, Quoting Alan Stern <st...@rowland.harvard.edu>: On Tue, 21 Feb 2017, Gustavo A. R. Silva wrote: Code refactoring to make the flow easier to follow and add missing 'continue' for case USB_ENDPOINT_XFER_INT. Addresses-Coverity-ID: 1248733 Cc: Alan Stern <st...@rowland.ha

[PATCH] usb: misc: add a missing continue and refactor code

2017-02-21 Thread Gustavo A. R. Silva
Code refactoring to make the flow easier to follow and add missing 'continue' for case USB_ENDPOINT_XFER_INT. Addresses-Coverity-ID: 1248733 Cc: Alan Stern <st...@rowland.harvard.edu> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/misc/us

Re: [usb-misc] question about missing break in switch

2017-02-21 Thread Gustavo A. R. Silva
Hi Alan, Quoting Alan Stern <st...@rowland.harvard.edu>: On Mon, 20 Feb 2017, Gustavo A. R. Silva wrote: Hello everybody, I ran into the following piece of code at drivers/usb/misc/usbtest.c:149 (linux-next) 149/* take the first altsetting with in-bulk + out-bul

[usb-misc] question about missing break in switch

2017-02-20 Thread Gustavo A. R. Silva
uot; It would be great to hear any comment about this. Thank you -- Gustavo A. R. Silva -- 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

[PATCH] usb: misc: remove unnecessary code

2017-02-20 Thread Gustavo A. R. Silva
'val' is an unsigned variable, and less-than-zero comparison of an unsigned variable is never true. Addresses-Coverity-ID: 1230257 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/misc/lvstest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH] usb: host: add cast to avoid potential integer overflow

2017-02-16 Thread Gustavo A. R. Silva
A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/host/xhci.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 50aee8b..8094d9a 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4

[PATCH] usb: atm: remove unnecessary code

2017-02-16 Thread Gustavo A. R. Silva
'index' is an unsigned variable, and less-than-zero comparison of an unsigned variable is never true. Addresses-Coverity-ID: 115396 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/atm/cxacru.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH] usb: misc: remove unnecessary code

2017-02-16 Thread Gustavo A. R. Silva
'val' is an unsigned variable, and less-than-zero comparison of an unsigned variable is never true. Addresses-Coverity-ID: 1230256 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/misc/lvstest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH] usb: storage: add missing pre-increment to variable

2017-02-14 Thread Gustavo A. R. Silva
Add missing pre-increment to 'waitcount' variable used in do-while loop. Addresses-Coverity-ID: 1011631 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/storage/jumpshot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/s

Re: [usb-storage] usb: storage: suspicious code

2017-02-14 Thread Gustavo A. R. Silva
Hi Oliver, Quoting Oliver Neukum <oneu...@suse.com>: Am Dienstag, den 14.02.2017, 23:06 -0600 schrieb Gustavo A. R. Silva: Hi, waitcount = 0; do { result = jumpshot_get_status(us); if (result != USB_STOR_TRANSPORT_GOOD) { // I have not experimented t

usb: storage: suspicious code

2017-02-14 Thread Gustavo A. R. Silva
tcount < 10) In case 'waitcount' isn't needed, lines 318 and 319 should be removed. Can someone help me to clarify this so I can write a patch to fix this code? Thank you -- Gustavo A. R. Silva -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a me

[PATCH] usb: class: remove logically dead code

2017-02-14 Thread Gustavo A. R. Silva
Remove logically dead code. 'cntr' is always equal to zero when the following line of code is executed: rv = cntr ? cntr : -EAGAIN; Addresses-Coverity-ID: 113227 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/class/cdc-wdm.c | 2 +- 1 file changed, 1 insertion

[PATCH v2 2/2] usb: gadget: udc: remove unnecessary variable and update function prototype

2017-02-14 Thread Gustavo A. R. Silva
Remove unnecessary variable and update function prototype. Acked-by: Michal Nazarewicz <min...@mina86.com> Reviewed-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- Changes in v2: None. drivers/usb/gadget/ud

[PATCH v2 1/2] usb: gadget: udc: avoid use of freed pointer

2017-02-14 Thread Gustavo A. R. Silva
Rewrite udc_free_dma_chain() function to avoid use of pointer after free. Addresses-Coverity-ID: 1091172 Acked-by: Michal Nazarewicz <min...@mina86.com> Reviewed-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com>

Re: [PATCH 1/2] usb: gadget: udc: avoid use of freed pointer

2017-02-14 Thread Gustavo A. R. Silva
Hi Michal, Quoting Michal Nazarewicz <min...@mina86.com>: On Mon, Feb 13 2017, Gustavo A. R. Silva wrote: Rewrite udc_free_dma_chain() function to avoid use of pointer after free. Addresses-Coverity-ID: 1091172 Reviewed-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>

[PATCH v2] usb: musb: add code comment for clarification

2017-02-14 Thread Gustavo A. R. Silva
Add code comment to make it clear that the fall-through is intentional. Read the link for more details: https://lkml.org/lkml/2017/2/9/292 Addresses-Coverity-ID: 1397608 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- Changes in v2: Fix tabs and line-wrapping in previous

Re: [PATCH] usb: musb: add code comment for clarification

2017-02-14 Thread Gustavo A. R. Silva
Quoting Greg KH <gre...@linuxfoundation.org>: On Fri, Feb 10, 2017 at 06:57:41PM -0600, Gustavo A. R. Silva wrote: Add code comment to make it clear that the fall-through is intentional. Read the link for more details: https://lkml.org/lkml/2017/2/9/292 Signed-off-by: Gustavo A. R.

[PATCH v3] usb: gadget: udc: remove pointer dereference after free

2017-02-13 Thread Gustavo A. R. Silva
Remove pointer dereference after free. Addresses-Coverity-ID: 1091173 Acked-by: Michal Nazarewicz <min...@mina86.com> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- Changes in v2: Move pointer dereference before pci_pool_free() Set pointer to NULL after free C

Re: [PATCH v2] usb: gadget: udc: remove pointer dereference after free

2017-02-13 Thread Gustavo A. R. Silva
Hi Michal, Quoting Michal Nazarewicz <min...@mina86.com>: On Sat, Feb 11 2017, Gustavo A. R. Silva wrote: Remove pointer dereference after free and set pointer to NULL after free. Addresses-Coverity-ID: 1091173 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> Acke

[PATCH 1/2] usb: gadget: udc: avoid use of freed pointer

2017-02-13 Thread Gustavo A. R. Silva
Rewrite udc_free_dma_chain() function to avoid use of pointer after free. Addresses-Coverity-ID: 1091172 Reviewed-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/udc/amd5536udc.c | 20 +++

[PATCH 2/2] usb: gadget: udc: remove unnecessary variable and update function prototype

2017-02-13 Thread Gustavo A. R. Silva
Remove unnecessary variable and update function prototype. Reviewed-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/udc/amd5536udc.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-)

[PATCH 0/2] avoid use of freed pointer

2017-02-13 Thread Gustavo A. R. Silva
Hello, This patch series addesses Coverity ID 1091172, which reports the use of a freed pointer. udc_free_dma_chain() function was rewritten in order to fix this issue. Unnecessary 'ret_val' variable was removed and the function prototype was modified. Thanks Gustavo A. R. Silva (2): usb

[PATCH v2] usb: gadget: udc: remove pointer dereference after free

2017-02-11 Thread Gustavo A. R. Silva
Remove pointer dereference after free and set pointer to NULL after free. Addresses-Coverity-ID: 1091173 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- Changes in v2: Move pointer dereference before pci_pool_free() Set pointer to NULL after free drivers/usb/gadg

[PATCH] usb: musb: add code comment for clarification

2017-02-10 Thread Gustavo A. R. Silva
Add code comment to make it clear that the fall-through is intentional. Read the link for more details: https://lkml.org/lkml/2017/2/9/292 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/musb/musb_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/d

[PATCH] drivers: usb: musb: add code comment for clarification

2017-02-09 Thread Gustavo A. R. Silva
Add code comment to make it clear that the fall-through is intentional. Read the link for more details: https://lkml.org/lkml/2017/2/9/292 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/musb/musb_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drive

Re: drivers: usb: musb: question about missing break in switch

2017-02-09 Thread Gustavo A. R. Silva
Hello Bin, Quoting Bin Liu <b-...@ti.com>: On Thu, Feb 09, 2017 at 02:37:34AM -0600, Gustavo A. R. Silva wrote: Hello everybody, I ran into the following piece of code at drivers/usb/musb/musb_core.c:1854 (linux-next) 1854/* 1855 * Check the musb devctl session bit to determine if w

drivers: usb: musb: question about missing break in switch

2017-02-09 Thread Gustavo A. R. Silva
MUSB_QUIRK_A_DISCONNECT_19, in case "if (musb->quirk_retries--)" turns to be false. My question here is if this code is intentional? In case it is not, I will write a patch to fix this, but first it would be great to hear any comment about it. Thank you -- Gustavo A. R. Silva

[PATCH] drivers: usb: usbip: Add missing break statement to switch

2017-02-09 Thread Gustavo A. R. Silva
Add missing break statement to prevent the code for case USB_PORT_FEAT_C_RESET falling through to the default case. Addresses-Coverity-ID: 143155 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/usbip/vhci_hcd.c | 1 + 1 file changed, 1 insertion(+) diff

drivers: usb: dwc3: A question...

2017-02-09 Thread Gustavo A. R. Silva
the case for OMAP_DWC3_ID_FLOAT is not terminated by a break statement, and it falls through to the next case OMAP_DWC3_VBUS_OFF. My question here is if for any reason this code is intentional? In case it is not, I will write a patch to fix this, but first it would be great to hear any co

Re: [PATCH] drivers: usb: gadget: udc: remove pointer dereference after free

2017-02-08 Thread Gustavo A. R. Silva
Hi Andy, Quoting Andy Shevchenko <andriy.shevche...@linux.intel.com>: On Wed, 2017-02-08 at 13:15 -0600, Gustavo A. R. Silva wrote: Remove pointer dereference and write after free. It's wrong description. There is no write after free. The memory is still in pool and one may

[PATCH] drivers: usb: gadget: udc: remove pointer dereference after free

2017-02-08 Thread Gustavo A. R. Silva
Remove pointer dereference and write after free. Addresses-Coverity-ID: 1091173 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/udc/pch_udc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch

Re: [PATCH 1/2] drivers: usb: gadget: udc: add missing break in switch

2017-02-08 Thread Gustavo A. R. Silva
Hello Felipe, Quoting Felipe Balbi <ba...@kernel.org>: Hi, "Gustavo A. R. Silva" <garsi...@embeddedor.com> writes: Add missing break in switch. Addresses-Coverity-ID: 201385 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/udc

[PATCH 2/2] drivers: usb: gadget: udc: remove logically dead code

2017-02-07 Thread Gustavo A. R. Silva
Remove unnecesary code because zlt never evaluates to zero. Addresses-Coverity-ID: 1226747 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/udc/mv_udc_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadg

[PATCH 1/2] drivers: usb: gadget: udc: add missing break in switch

2017-02-07 Thread Gustavo A. R. Silva
Add missing break in switch. Addresses-Coverity-ID: 201385 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/udc/mv_udc_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c

[PATCH] drivers: usb: early: remove unused code

2017-02-07 Thread Gustavo A. R. Silva
Remove this line of code because devnum is overwritten before it can be used. This could happen if line of code 609 (goto try_again;) is executed. Otherwise, devnum is never used again. Addresses-Coverity-ID: 1226870 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drive

[PATCH] drivers: usb-misc: sisusbvga: remove dead code

2017-02-07 Thread Gustavo A. R. Silva
The condition modex % 16 cannot be true when modex value is equal to 640 The condition du & 0xff cannot be true when du value is equal to 0x1400 Addresses-Coverity-Id: 101163 Addresses-Coverity-Id: 744373 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/misc

<    1   2