Re: [PATCH] HID: hiddev: fix potential Spectre v1

2018-10-17 Thread Gustavo A. R. Silva
Hi Breno, On 10/17/18 9:47 PM, Breno Leitao wrote: > uref->usage_index can be indirectly controlled by userspace, hence leading > to a potential exploitation of the Spectre variant 1 vulnerability. > > This problem might show up in the cmd = HIDIOCGCOLLECTIONINDEX flow at > function >

Re: [PATCH v3] usbip: vhci_sysfs: fix potential Spectre v1

2018-05-22 Thread Gustavo A. R. Silva
On 05/22/2018 10:56 AM, Shuah Khan wrote: On 05/18/2018 07:13 PM, Gustavo A. R. Silva wrote: pdev_nr and rhport can be controlled by user-space, hence leading to a potential exploitation of the Spectre variant 1 vulnerability. This issue was detected with the help of Smatch: drivers/usb

Re: [PATCH v2] usbip: vhci_sysfs: fix potential Spectre v1

2018-05-19 Thread Gustavo A. R. Silva
On 05/19/2018 02:04 AM, Greg Kroah-Hartman wrote: Greg, I've been talking with Dan Williams (intel) about this kind of issues [1] and it seems my original assumptions are correct. Hence, this patch is not useful and, in order to actually prevent speculation here we would need to pass the

[PATCH v3] usbip: vhci_sysfs: fix potential Spectre v1

2018-05-18 Thread Gustavo A. R. Silva
https://marc.info/?l=linux-kernel=152449131114778=2 Cc: sta...@vger.kernel.org Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v3: - Pass the addresses of pdev_nr and rhport into valid_port and valid_args. Changes in v2: - Place the barriers into valid_p

Re: [PATCH v2] usbip: vhci_sysfs: fix potential Spectre v1

2018-05-18 Thread Gustavo A. R. Silva
On 05/18/2018 11:06 AM, Shuah Khan wrote: On 05/18/2018 07:47 AM, Greg Kroah-Hartman wrote: On Thu, May 17, 2018 at 03:16:28PM -0500, Gustavo A. R. Silva wrote: pdev_nr and rhport can be controlled by user-space, hence leading to a potential exploitation of the Spectre variant 1

[PATCH v2] usbip: vhci_sysfs: fix potential Spectre v1

2018-05-17 Thread Gustavo A. R. Silva
https://marc.info/?l=linux-kernel=152449131114778=2 Cc: sta...@vger.kernel.org Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Place the barriers into valid_port. drivers/usb/usbip/vhci_sysfs.c | 6 ++ 1 file changed, 6 insertions(+) diff -

Re: [PATCH] usbip: vhci_sysfs: fix potential Spectre v1

2018-05-17 Thread Gustavo A. R. Silva
On 05/17/2018 02:15 PM, Greg Kroah-Hartman wrote: Shouldn't we just do this in one place, in the valid_port() function? That way it keeps the range checking logic in one place (now it is in 3 places in the function), which should make maintenance much simpler. Yep, I thought about that,

Re: [PATCH] usbip: vhci_sysfs: fix potential Spectre v1

2018-05-17 Thread Gustavo A. R. Silva
Hi Greg, On 05/17/2018 01:51 AM, Greg Kroah-Hartman wrote: On Wed, May 16, 2018 at 05:22:00PM -0500, Gustavo A. R. Silva wrote: pdev_nr and rhport can be controlled by user-space, hence leading to a potential exploitation of the Spectre variant 1 vulnerability. This issue was detected

[PATCH] usbip: vhci_sysfs: fix potential Spectre v1

2018-05-16 Thread Gustavo A. R. Silva
tps://marc.info/?l=linux-kernel=152449131114778=2 Cc: sta...@vger.kernel.org Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/usb/usbip/vhci_sysfs.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.

[PATCH] typec: tcpm: Fix incorrect 'and' operator

2018-04-30 Thread Gustavo A. R. Silva
Currently, logical and is being used instead of *bitwise* and. Fix this by using a proper bitwise and operator. Addresses-Coverity-ID: 1468455 ("Logical vs. bitwise operator") Fixes: 64f7c494a3c0 ("typec: tcpm: Add support for sink PPS related messages") Signed-off-by: Gusta

[PATCH] usb: core: hcd: mark expected switch fall-through

2018-04-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 1468266 ("Missing break in switch") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/usb/core/hcd.c | 1 + 1 file chan

[PATCH v2] USB: wusbcore: crypto: Remove VLA usage

2018-03-16 Thread Gustavo A. R. Silva
, in which case the code would look as follows instead: iv = kcalloc(crypto_skcipher_ivsize(tfm_cbc), sizeof(*iv), GFP_KERNEL); but if the data type of _iv_ never changes, or the type size is always one byte, kzalloc is good enough. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.

Re: [PATCH] USB: wusbcore: crypto: Remove VLA usage

2018-03-16 Thread Gustavo A. R. Silva
I just discovered an issue with this patch. Please, drop it. I'll send v2 shortly. Thanks -- Gustavo On 03/16/2018 08:01 AM, Gustavo A. R. Silva wrote: In preparation to enabling -Wvla, remove VLA and replace it with dynamic memory allocation instead. The use of stack Variable Length

[PATCH] USB: wusbcore: crypto: Remove VLA usage

2018-03-16 Thread Gustavo A. R. Silva
, in which case the code would look as follows instead: iv = kcalloc(crypto_skcipher_ivsize(tfm_cbc), sizeof(*iv), GFP_KERNEL); but if the data type of _iv_ never changes, or the type size is always one byte, kzalloc is good enough. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.

[PATCH] usb: dwc2: gadget: Use true and false for boolean values

2018-01-23 Thread Gustavo A. R. Silva
Assign true or false to boolean variables instead of an integer value. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/usb/dwc2/gadget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/d

[PATCH] USB: misc: chaoskey: Use true and false for boolean values

2018-01-23 Thread Gustavo A. R. Silva
Assign true or false to boolean variables instead of an integer value. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/usb/misc/chaoskey.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff

[PATCH] usb: gadget: compress return logic into one line

2018-01-18 Thread Gustavo A. R. Silva
Simplify return logic and avoid unnecessary variable assignment. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/legacy/ncm.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/legacy/ncm.c b/drivers/usb/gadget/

[PATCH] USB: usbip: remove useless call in usbip_recv

2018-01-02 Thread Gustavo A. R. Silva
Calling msg_data_left() is only useful for its return value, which in this particular case is ignored. Fix this by removing such call. Addresses-Coverity-ID: 1427080 Fixes: 90120d15f4c3 ("usbip: prevent leaking socket pointer address in messages") Signed-off-by: Gustavo A. R. Si

[PATCH] usbnet: ipheth: fix potential null pointer dereference in ipheth_carrier_set

2017-11-17 Thread Gustavo A. R. Silva
evice not ready") Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/net/usb/ipheth.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c index ca71f6c..7275761 100644 --- a/drivers/net/usb/ipheth

Re: [PATCH 6/9] usb: host: isp1362-hcd: mark expected switch fall-through

2017-11-01 Thread Gustavo A. R. Silva
Quoting Greg Kroah-Hartman <gre...@linuxfoundation.org>: On Wed, Oct 25, 2017 at 02:05:05PM -0500, Gustavo A. R. Silva wrote: Greg, Quoting "Gustavo A. R. Silva" <garsi...@embeddedor.com>: > In preparation to enabling -Wimplicit-fallthrough, mark switch cases

[PATCH] usb: host: isp1362-hcd: fix missing break in switch

2017-11-01 Thread Gustavo A. R. Silva
Add missing break statement to prevent the code for case C_HUB_OVER_CURRENT from falling through to case C_HUB_LOCAL_POWER. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/host/isp1362-hcd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/i

Re: [PATCH 6/9] usb: host: isp1362-hcd: mark expected switch fall-through

2017-11-01 Thread Gustavo A. R. Silva
tchset. Yes, it all depends, the rest of these patches are already in my tree. OK. I'll send a new patch shortly. Thanks! -- 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 Mor

Re: [PATCH] USB: serial: io_edgeport: mark expected switch fall-throughs

2017-10-30 Thread Gustavo A. R. Silva
hrough" comment in the branch, but removing the else might be better. Thanks for the suggestion. This code is pretty hard to read as is and could really use some clean up... I agree. I'll send a V2 of this patch and then let's see if I can help with some code refactoring. 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

Re: [PATCH] USB: serial: io_edgeport: mark expected switch fall-throughs

2017-10-28 Thread Gustavo A. R. Silva
Quoting Bjørn Mork <bj...@mork.no>: "Gustavo A. R. Silva" <garsi...@embeddedor.com> writes: In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Notice that in this particular case I replaced "...drop on thro

[PATCH] usb: typec: tps6598x: mark expected switch fall-through

2017-10-27 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/typec/tps6598x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/typec/tps6598x.c b/d

[PATCH] usb: storage: sddr55: mark expected switch fall-through

2017-10-27 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/storage/sddr55.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/storage/sddr55.c b/d

Re: [PATCH] usb: gadget: composite: mark expected switch fall-throughs

2017-10-26 Thread Gustavo A. R. Silva
Hi Felipe, Quoting Felipe Balbi <ba...@kernel.org>: "Gustavo A. R. Silva" <garsi...@embeddedor.com> writes: In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi..

[PATCH] usb: wusbcore: wa-xfer: mark expected switch fall-through

2017-10-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/wusbcore/wa-xfer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/wusbcore/wa-xf

[PATCH 5/9] usb: host: ehci-hcd: mark expected switch fall-through

2017-10-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/host/ehci-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/hos

[PATCH 1/9] usb: host: fotg210-hcd: mark expected switch fall-through

2017-10-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/host/fotg210-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/us

[PATCH 0/9] mark expected switch fall-throughs

2017-10-25 Thread Gustavo A. R. Silva
y in place. So I replaced them with proper "fall through" comments, which is what GCC is expecting to find. Thanks! Gustavo A. R. Silva (9): usb: host: fotg210-hcd: mark expected switch fall-through usb: host: xhci: mark expected switch fall-through usb: host: xhci-mem: mark expected s

[PATCH 4/9] usb: host: ohci-hcd: mark expected switch fall-through

2017-10-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/host/ohci-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/hos

[PATCH 2/9] usb: host: xhci: mark expected switch fall-through

2017-10-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/host/xhci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/xhci.c b/drivers/us

Re: [PATCH 6/9] usb: host: isp1362-hcd: mark expected switch fall-through

2017-10-25 Thread Gustavo A. R. Silva
Greg, Quoting "Gustavo A. R. Silva" <garsi...@embeddedor.com>: In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/host/isp1362-hcd.c |

[PATCH 8/9] usb: host: xhci-hub: mark expected switch fall-through

2017-10-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/host/xhci-hub.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/xhci-hub.c b/drive

[PATCH 9/9] usb: host: pci-quirks: mark expected switch fall-through

2017-10-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/host/pci-quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/ho

[PATCH 6/9] usb: host: isp1362-hcd: mark expected switch fall-through

2017-10-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/host/isp1362-hcd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/isp1362-h

[PATCH 7/9] usb: host: oxu210hp-hcd: mark expected switch fall-through

2017-10-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/host/oxu210hp-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/us

[PATCH 3/9] usb: host: xhci-mem: mark expected switch fall-through

2017-10-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/host/xhci-mem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/xhci-mem.c b/drive

[PATCH] usb: gadget: udc: dummy_hcd: mark expected switch fall-throughs

2017-10-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/udc/dummy_hcd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/gadg

[PATCH] usb: gadget: composite: mark expected switch fall-throughs

2017-10-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/composite.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drive

[PATCH] usb: class: usbtmc: mark expected switch fall-through

2017-10-24 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/class/usbtmc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/class/usbtmc.c b/drive

[PATCH] usb: atm: cxacru: mark expected switch fall-throughs

2017-10-24 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/atm/cxacru.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/atm/cxacru.c b/drivers/u

[PATCH] usb: host: isp116x-hcd: mark expected switch fall-throughs

2017-10-24 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 115006 Addresses-Coverity-ID: 115007 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/host/isp116x-hcd.c | 3 +++ 1 file chan

[PATCH] usb: gadget: f_phonet: mark expected switch fall-throughs

2017-10-24 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 115004 Addresses-Coverity-ID: 115005 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/function/f_phonet.c | 2 ++ 1 file c

[PATCH] usb: serial: kobil_sct: mark expected switch fall-through

2017-10-24 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 115014 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/serial/kobil_sct.c | 1 + 1 file changed, 1 insertion(+) diff --git a/d

[PATCH] usb: storage: uas: mark expected switch fall-through

2017-10-24 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 115016 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/storage/uas.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drive

[PATCH] usb: gadget: goku_udc: mark expected switch fall-throughs

2017-10-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 145713 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/udc/goku_udc.c | 14 +- 1 file changed, 9 insertions

[PATCH] usb: gadget: serial: mark expected switch fall-through

2017-10-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 1350962 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/function/u_serial.c | 1 + 1 file changed, 1 insertion(+) diff

[PATCH] usb: musb_core: mark expected switch fall-through

2017-10-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 1397608 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] usb: gadget: f_tcm: mark expected switch fall-through

2017-10-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 703128 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/function/f_tcm.c | 1 + 1 file changed, 1 insertion(+) diff

[PATCH] usb: core: urb: mark expected switch fall-through

2017-10-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 1162594 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/core/urb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/us

[PATCH] usb: image: mdc800: mark expected switch fall-through

2017-10-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/image/mdc800.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/image/mdc800.c b/drive

[PATCH] usb: phy: phy-msm-usb: mark expected switch fall-through

2017-10-23 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 1222118 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/phy/phy-msm-usb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/d

[PATCH] usb: misc: ftdi-elan: fix duplicated code for different branches

2017-08-12 Thread Gustavo A. R. Silva
Refactor code in order to avoid identical code for different branches. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/usb/misc/ftdi-elan.c | 27 +-- 1 file changed, 1 insertion(+), 26 del

Re: [PATCH] usb: gadget: udc: renesas_usb3: fix error return code in renesas_usb3_probe()

2017-08-09 Thread Gustavo A. R. Silva
Hi Yoshihiro, On 08/09/2017 06:44 AM, Yoshihiro Shimoda wrote: Hi Gustavo, Thank you for the patch! I'm glad to help :) -Original Message- From: Gustavo A. R. Silva Sent: Wednesday, August 9, 2017 7:35 AM platform_get_irq() returns an error code, but the renesas_usb3 driver

[PATCH] usb: ehci-omap: fix error return code in ehci_hcd_omap_probe()

2017-08-08 Thread Gustavo A. R. Silva
/git/torvalds/linux.git/commit/?id=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af Print and propagate the return value of platform_get_irq on failure. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/usb/host/ehci-omap

[PATCH] usb: gadget: udc: renesas_usb3: fix error return code in renesas_usb3_probe()

2017-08-08 Thread Gustavo A. R. Silva
/kernel/git/torvalds/linux.git/commit/?id=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af Print error message and propagate the return value of platform_get_irq on failure. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/usb/

[PATCH] usb: dwc3: omap: fix error return code in dwc3_omap_probe()

2017-08-07 Thread Gustavo A. R. Silva
/torvalds/linux.git/commit/?id=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af Print and propagate the return value of platform_get_irq on failure. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/usb/dwc3/dwc3-omap.c | 4 +

[PATCH] usb: imx21-hcd: fix error return code in imx21_probe()

2017-08-07 Thread Gustavo A. R. Silva
/torvalds/linux.git/commit/?id=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af Print error message and propagate the return value of platform_get_irq on failure. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/usb/host/imx21

Re: [PATCH] usb: isp1760: compress return logic into one line

2017-07-10 Thread Gustavo A. R. Silva
Hi Oliver, Quoting Oliver Neukum <oneu...@suse.com>: Am Sonntag, den 09.07.2017, 21:00 -0500 schrieb Gustavo A. R. Silva : Simplify return logic to avoid unnecessary variable assignment. This issue was detected using Coccinelle and the following semantic patch: Hi, I need to ask:

[PATCH] usb: gadget: fusb300_udc: compress return logic into one line

2017-07-09 Thread Gustavo A. R. Silva
Simplify return logic to avoid unnecessary variable declaration and assignment. These issues were detected using Coccinelle and the following semantic patch: @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Gustavo A. R. Silva <ga

[PATCH] usb: gadget: fsl_udc_core: compress return logic into one line

2017-07-09 Thread Gustavo A. R. Silva
Simplify return logic to avoid unnecessary variable assignment. This issue was detected using Coccinelle and the following semantic patch: @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- d

[PATCH] usb: gadget: udc-xilinx: compress return logic into one line

2017-07-09 Thread Gustavo A. R. Silva
Simplify return logic to avoid unnecessary variable assignment. This issue was detected using Coccinelle and the following semantic patch: @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- d

[PATCH] usb: chipidea: udc: compress return logic into line

2017-07-09 Thread Gustavo A. R. Silva
Simplify return logic to avoid unnecessary variable assignment. This issue was detected using Coccinelle and the following semantic patch: @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- d

[PATCH] usb: gadget: legacy: compress return logic into one line

2017-07-09 Thread Gustavo A. R. Silva
Simplify return logic to avoid unnecessary variable assignments. These issues were detected using Coccinelle and the following semantic patch: @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.

[PATCH 1/2] usb: gadget: compress return logic into one line

2017-07-09 Thread Gustavo A. R. Silva
Simplify return logic to avoid unnecessary variable declaration and assignment. This issue was detected using Coccinelle and the following semantic patch: @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.

[PATCH 2/2] usb: gadget: use unsigned int instead of unsigned in usb_otg_descriptor_alloc()

2017-07-09 Thread Gustavo A. R. Silva
Prefer unsigned int to bare use of unsigned. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c index 23bfa7d..968179d

[PATCH] usb: gadget: legacy: ncm: compress return logic into one line

2017-07-09 Thread Gustavo A. R. Silva
Simplify return logic to avoid unnecessary variable assignment. This issue was detected using Coccinelle and the following semantic patch: @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- d

[PATCH] usb: gadget: legacy: dbgp: compress return logic into one line

2017-07-09 Thread Gustavo A. R. Silva
Simplify return logic to avoid unnecessary variable declaration and assignment. This issue was detected using Coccinelle and the following semantic patch: @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.

[PATCH] usb: gadget: configfs: compress return logic into one line

2017-07-09 Thread Gustavo A. R. Silva
Simplify return logic to avoid unnecessary variable assignment. This issue was detected using Coccinelle and the following semantic patch: @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- d

[PATCH] usb: isp1760: compress return logic into one line

2017-07-09 Thread Gustavo A. R. Silva
Simplify return logic to avoid unnecessary variable assignment. This issue was detected using Coccinelle and the following semantic patch: @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- d

[PATCH] usb: gadget: function: constify snd_pcm_ops structure

2017-07-07 Thread Gustavo A. R. Silva
, e2; position p; @@ snd_pcm_set_ops(e1, e2, @p) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct snd_pcm_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_pcm_ops i = { ... }; Signed-off-by: Gustavo A. R. Silva <ga

[PATCH] usb: gadget: udc-xilinx: remove useless variable assignment in xudc_read_fifo()

2017-06-27 Thread Gustavo A. R. Silva
Value assigned to variable bufferspace at line 637 is overwritten at line 613, before it can be used. This makes such variable assignment useless. Addresses-Coverity-ID: 1397677 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/udc/udc-xilinx.c | 1 -

[PATCH] usb: musb: compress return logic into one line

2017-06-20 Thread Gustavo A. R. Silva
Simplify return logic to avoid unnecessary variable assignment. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/musb/musb_host.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_

[PATCH] uwb: i1480: add missing goto

2017-05-19 Thread Gustavo A. R. Silva
Add missing goto. Addresses-Coverity-ID: 1226913 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/uwb/i1480/dfu/phy.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/uwb/i1480/dfu/phy.c b/drivers/uwb/i1480/dfu/phy.c index 3b1a87d..1ac8526 100644 --- a/d

Re: [uwb-i1480] question about value overwrite

2017-05-19 Thread Gustavo A. R. Silva
Hi Greg, Quoting Greg KH <gre...@linuxfoundation.org>: On Thu, May 18, 2017 at 06:00:06PM -0500, Gustavo A. R. Silva wrote: Hello everybody, While looking into Coverity ID 1226913 I ran into the following piece of code at drivers/uwb/i1480/dfu/phy.c:99: 99static 100int i1480_mp

[uwb-i1480] question about value overwrite

2017-05-18 Thread Gustavo A. R. Silva
ze_t size) dev_err(i1480->dev, "MPI-READ: command execution failed: %d\n", reply->bResultCode); result = -EIO; + goto out; } for (cnt = 0; cnt < size; cnt++) { if (reply->

Re: [usb-gadget-udc] question about null check after calling phys_to_virt() function

2017-05-16 Thread Gustavo A. R. Silva
Hi Felipe, Quoting Felipe Balbi <ba...@kernel.org>: Hi, "Gustavo A. R. Silva" <garsi...@embeddedor.com> writes: Hello everybody, While looking into Coverity ID 145958 I ran into the following piece of code at drivers/usb/gadget/udc/amd5536udc.c:852: }

[usb-gadget-udc] question about null check after calling phys_to_virt() function

2017-05-02 Thread Gustavo A. R. Silva
d->bufptr = req->req.dma + i; /* assign buffer */ - else - break; + td->bufptr = req->req.dma + i; /* assign buffer */ What do you think? Thanks in advance for your comments -- Gustavo A. R. Silva -- To unsubscribe from this list

[PATCH v2] usb: gadget: udc: add null check before pointer dereference

2017-05-02 Thread Gustavo A. R. Silva
Add null check before dereferencing dev->regs pointer inside net2280_led_shutdown() function. Addresses-Coverity-ID: 101783 Cc: Alan Stern <st...@rowland.harvard.edu> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- Changes in v2: Move the net2280_led_shutdo

[PATCH] usb: host: remove unnecessary null check

2017-05-02 Thread Gustavo A. R. Silva
Remove unnecessary null check. udev->tt cannot ever be NULL when this section of code runs. Addresses-Coverity-ID: 100828 Cc: Alan Stern <st...@rowland.harvard.edu> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/host/ehci-sched.c | 2 +- 1 file chang

Re: [PATCH] usb: gadget: udc: add null check before pointer dereference

2017-05-02 Thread Gustavo A. R. Silva
Hi Alan, Quoting Alan Stern <st...@rowland.harvard.edu>: On Mon, 1 May 2017, Gustavo A. R. Silva wrote: Add null check before dereferencing dev->regs pointer inside net2280_led_shutdown() function. Addresses-Coverity-ID: 101783 Signed-off-by: Gustavo A. R. Silva <garsi...@em

Re: [usb-host] question about pointer dereference before null check

2017-05-02 Thread Gustavo A. R. Silva
Hi Alan, Quoting Alan Stern <st...@rowland.harvard.edu>: On Mon, 1 May 2017, Gustavo A. R. Silva wrote: Hello everybody, While taking a look into Coverity ID 100828 I ran into the following piece of code at drivers/usb/host/ehci-sched.c:1096: u32 add

[PATCH] usb: gadget: udc: add null check before pointer dereference

2017-05-01 Thread Gustavo A. R. Silva
Add null check before dereferencing dev->regs pointer inside net2280_led_shutdown() function. Addresses-Coverity-ID: 101783 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/gadget/udc/net2280.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) d

[usb-host] question about pointer dereference before null check

2017-05-01 Thread Gustavo A. R. Silva
think_time : 0; +think_time = dev->tt->think_time; But I can't tell for sure, so in case dev->tt is NULL, a good strategy to properly update the _addr_ variable would be needed. What do you think? I would really appreciate any comment on this, Thank you! -- Gustavo A. R. Silva -- To

Re: [PATCH 2/2] usb: misc: refactor code

2017-04-04 Thread Gustavo A. R. Silva
Hello, Quoting Felipe Balbi <felipe.ba...@linux.intel.com>: Hi, "Gustavo A. R. Silva" <garsi...@embeddedor.com> writes: Code refactoring to make the flow easier to follow. Cc: Alan Stern <st...@rowloand.harvard.edu> Cc: Greg Kroah-Hartman <gre...@linuxfoundat

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

2017-04-03 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-04-03 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>

[PATCH v2 1/2] usb: misc: add missing continue in switch

2017-04-03 Thread Gustavo A. R. Silva
Add missing continue in switch. Addresses-Coverity-ID: 1248733 Cc: Alan Stern <st...@rowloand.harvard.edu> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- Changes in v2: None. drivers/usb/misc/usbtest.c | 1

[PATCH v2 2/2] usb: misc: refactor code

2017-04-03 Thread Gustavo A. R. Silva
Code refactoring to make the flow easier to follow. Cc: Alan Stern <st...@rowloand.harvard.edu> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- Changes in v2: Remove unfruitful changes in previous pat

Re: [PATCH 2/2] usb: misc: refactor code

2017-04-03 Thread Gustavo A. R. Silva
Hi Alan, Quoting Alan Stern <st...@rowland.harvard.edu>: On Mon, 3 Apr 2017, Gustavo A. R. Silva wrote: Code refactoring to make the flow easier to follow. Cc: Alan Stern <st...@rowloand.harvard.edu> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> Signed-off-by: G

[PATCH 2/2] usb: misc: refactor code

2017-04-03 Thread Gustavo A. R. Silva
Code refactoring to make the flow easier to follow. Cc: Alan Stern <st...@rowloand.harvard.edu> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/misc/usbtest.c | 67 +--

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

2017-04-03 Thread Gustavo A. R. Silva
Quoting Alan Stern <st...@rowland.harvard.edu>: On Mon, 3 Apr 2017, Greg Kroah-Hartman wrote: On Mon, Apr 03, 2017 at 09:39:53AM -0500, Gustavo A. R. Silva wrote: > -Code refactoring to make the flow easier to follow. > -Add missing 'continue' for case USB_ENDPOINT_XFER_IN

[PATCH 1/2] usb: misc: add missing continue in switch

2017-04-03 Thread Gustavo A. R. Silva
Add missing continue in switch. Addresses-Coverity-ID: 1248733 Cc: Alan Stern <st...@rowloand.harvard.edu> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/usb/misc/usbtest.c | 1 + 1 file changed, 1

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

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

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

2017-03-10 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 v3] usb: gadget: udc: remove pointer dereference after free

2017-03-10 Thread Gustavo A. R. Silva
Hello, Quoting Felipe Balbi <ba...@kernel.org>: "Gustavo A. R. Silva" <garsi...@embeddedor.com> writes: Remove pointer dereference after free. Addresses-Coverity-ID: 1091173 Acked-by: Michal Nazarewicz <min...@mina86.com> Signed-off-by: Gustavo A. R. Si

Re: [PATCH] usb: misc: remove unnecessary code

2017-02-21 Thread Gustavo A. R. Silva
Hi Peter, Quoting Peter Senna Tschudin <peter.se...@gmail.com>: On Mon, Feb 20, 2017 at 05:28:46PM -0600, Gustavo A. R. Silva wrote: 'val' is an unsigned variable, and less-than-zero comparison of an unsigned variable is never true. I would add that val is set by kstrtoul() that co

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

2017-02-21 Thread Gustavo A. R. Silva
Quoting "Gustavo A. R. Silva" <garsi...@embeddedor.com>: 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_ENDPOIN

  1   2   >