[PATCH v2] usb: typec: fix an IS_ERR() vs NULL bug in hd3ss3220_probe()

2019-10-11 Thread Dan Carpenter
The device_get_named_child_node() function doesn't return error pointers, it returns NULL on error. Fixes: 1c48c759ef4b ("usb: typec: driver for TI HD3SS3220 USB Type-C DRP port controller") Signed-off-by: Dan Carpenter --- v2: remove -ENODEV instead of -EIO drivers/usb/typec/

[PATCH v2] USB: legousbtower: fix a signedness bug in tower_probe()

2019-10-11 Thread Dan Carpenter
The problem is that sizeof() is unsigned long so negative error codes are type promoted to high positive values and the condition becomes false. Fixes: 1d427be4a39d ("USB: legousbtower: fix slab info leak at probe") Signed-off-by: Dan Carpenter --- v2: style improvement suggested by Wa

Re: [PATCH] USB: legousbtower: fix a signedness bug in tower_probe()

2019-10-11 Thread Dan Carpenter
On Fri, Oct 11, 2019 at 03:51:26PM +0200, walter harms wrote: > > > Am 11.10.2019 15:35, schrieb Dan Carpenter: > > The problem is that sizeof() is unsigned long so negative error codes > > are type promoted to high positive values and the condition becomes >

[PATCH] usb: typec: fix an IS_ERR() vs NULL bug in hd3ss3220_probe()

2019-10-11 Thread Dan Carpenter
The device_get_named_child_node() function doesn't return error pointers, it returns NULL on error. Fixes: 1c48c759ef4b ("usb: typec: driver for TI HD3SS3220 USB Type-C DRP port controller") Signed-off-by: Dan Carpenter --- drivers/usb/typec/hd3ss3220.c | 4 ++-- 1 file change

[PATCH] USB: legousbtower: fix a signedness bug in tower_probe()

2019-10-11 Thread Dan Carpenter
The problem is that sizeof() is unsigned long so negative error codes are type promoted to high positive values and the condition becomes false. Fixes: 1d427be4a39d ("USB: legousbtower: fix slab info leak at probe") Signed-off-by: Dan Carpenter --- drivers/usb/misc/legousbtower.c | 2

[bug report] usb: chipidea: imx: enable vbus and id wakeup only for OTG events

2019-10-02 Thread Dan Carpenter
operty_read_bool(np, "usb-role-switch")) 438 data->usbmisc_data->ext_id = 1; ^^ 439 440 if (!IS_ERR(pdata.vbus_extcon.edev) || 441 of_property_read_bool(np, "usb-role-switch")) 442 data->usbmisc_data->ext_vbus = 1; These should probably check for NULL? This driver seems to check pretty consistently. 443 444 ret = imx_usbmisc_init_post(data->usbmisc_data); regards, dan carpenter

[PATCH v2] usb: typec: tcpm: usb: typec: tcpm: Fix a signedness bug in tcpm_fw_get_caps()

2019-10-01 Thread Dan Carpenter
The "port->typec_caps.data" and "port->typec_caps.type" variables are enums and in this context GCC will treat them as an unsigned int so they can never be less than zero. Fixes: ae8a2ca8a221 ("usb: typec: Group all TCPCI/TCPM code together") Signed-off-by:

[bug report] usb: cdns3: Add Cadence USB3 DRD Driver

2019-09-24 Thread Dan Carpenter
default: 341 ret = -EINVAL; 342 } 343 break; 344 default: 345 ret = -EINVAL; 346 } regards, dan carpenter

[PATCH] usb: cdns3: Fix use after free in probe error handling

2019-09-04 Thread Dan Carpenter
We can't use "wrap" after it has been freed. Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver") Signed-off-by: Dan Carpenter --- drivers/usb/cdns3/cdns3-pci-wrap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/cdns3/cd

[PATCH] usb: host: ohci-pxa27x: Fix and & vs | typo

2019-08-16 Thread Dan Carpenter
The code is supposed to clear the RH_A_NPS and RH_A_PSM bits, but it's a no-op because of the & vs | typo. This bug predates git and it was only discovered using static analysis so it must not affect too many people in real life. Signed-off-by: Dan Carpenter Acked-by: Alan Stern ---

Re: [PATCH] usb: host: ohci-pxa27x: Fix and & vs | typo

2019-08-14 Thread Dan Carpenter
I was looking at this code again today and I'm still convinced this patch is correct. Should I resend? regards, dan carpenter On Fri, Feb 23, 2018 at 03:33:00PM +0300, Dan Carpenter wrote: > The code is supposed to clear the RH_A_NPS and RH_A_PSM bits, but it's > a no-op bec

Re: [bug report] usb: gadget: u_serial: process RX in workqueue instead of tasklet

2019-06-24 Thread Dan Carpenter
On Mon, Jun 24, 2019 at 03:41:54PM +0200, mirq-li...@rere.qmqm.pl wrote: > On Mon, Jun 24, 2019 at 03:32:58PM +0300, Dan Carpenter wrote: > > Hello Michał Mirosław, > > > > This is a semi-automatic email about new static checker warnings. > > > > The patch 8b4

[bug report] usb: gadget: u_serial: process RX in workqueue instead of tasklet

2019-06-24 Thread Dan Carpenter
ty_throttled(tty)) ^^^ in the original code there was check for NULL here but the patch removed it. 439 schedule_delayed_work(&port->push, 1); 440 regards, dan carpenter

[bug report] usb: gadget: f_fs: OS descriptors support

2019-06-08 Thread Dan Carpenter
>type) { 2997 case USB_EXT_PROP_UNICODE: 2998 case USB_EXT_PROP_UNICODE_ENV: 2999 case USB_EXT_PROP_UNICODE_LINK: 3000 case USB_EXT_PROP_UNICODE_MULTI: 3001 ext_prop->data_len *= 2; 3002 break; 3003 } 3004 ext_prop->data = ext_prop_data; regards, dan carpenter

[PATCH] usb/hcd: Fix a NULL vs IS_ERR() bug in usb_hcd_setup_local_mem()

2019-06-07 Thread Dan Carpenter
The devm_memremap() function doesn't return NULL, it returns error pointers. Fixes: b0310c2f09bb ("USB: use genalloc for USB HCs with local memory") Signed-off-by: Dan Carpenter --- drivers/usb/core/hcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/d

[PATCH] usbip: stub_rx: tidy the indenting in is_clear_halt_cmd()

2019-04-24 Thread Dan Carpenter
There is an extra space character before the return statement. Signed-off-by: Dan Carpenter diff --git a/drivers/usb/usbip/stub_rx.c b/drivers/usb/usbip/stub_rx.c index 97b09a42a10c..f3230bed18af 100644 --- a/drivers/usb/usbip/stub_rx.c +++ b/drivers/usb/usbip/stub_rx.c @@ -17,9 +17,9 @@ static

[bug report] usb: chipidea: imx: add HSIC support

2018-12-22 Thread Dan Carpenter
PTR_ERR(data->pinctrl)); 326 return PTR_ERR(data->pinctrl); 327 } regards, dan carpenter

[PATCH] usb: gadget: Potential NULL dereference on allocation error

2018-12-21 Thread Dan Carpenter
7;t affect runtime. Signed-off-by: Dan Carpenter --- drivers/usb/gadget/function/f_sourcesink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c index 9cdef108fb1b..ed68a4860b7d 100644 --- a/d

[bug report] staging: typec: Fairchild FUSB302 Type-c chip driver

2018-12-14 Thread Dan Carpenter
t could easily be corrupted because multiple thread log stuff. So I don't really want to remove the checks because they do narrow the window where a race would have to occur before we would get memory corruption. But ideally we would just fix the race. regards, dan carpenter

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-07 Thread Dan Carpenter
-work patch. Can I use your idea with > dwc2_hsotg_ep_disable_lock() function to prepare new one? > Sparse lock checking is pretty crap, and I wouldn't go out of my way normally to make it happy... But of course you can use my idea. regards, dan carpenter

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-07 Thread Dan Carpenter
On Wed, Dec 05, 2018 at 12:52:22PM +, Minas Harutyunyan wrote: > Hi, > > On 12/4/2018 5:29 PM, Dan Carpenter wrote: > > On Tue, Dec 04, 2018 at 12:34:08PM +, Minas Harutyunyan wrote: > >> @@ -3185,12 +3183,13 @@ void dwc2_hsotg_disconnect(struct

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-06 Thread Dan Carpenter
ex) : DOEPCTL(index); > > - locked = spin_is_locked(&hsotg->lock); > - if (!locked) > - spin_lock_irqsave(&hsotg->lock, flags); > + spin_lock_irqsave(&hsotg->lock, flags); > One of the callers is already holding the hsotg->log. The spin_is_locked() test would avoid the deadlock. regards, dan carpenter

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-04 Thread Dan Carpenter
gain inside dwc2_hsotg_ep_disable(). I don't know the code very well and can't totally swear that this doesn't introduce a small race condition... Another option would be to introduce a new function which takes the lock and change all the other callers instead. To me that would be

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-11-23 Thread Dan Carpenter
Ugh... We also had a long thread about the v2 patch but it turns out the list was not CC'd. I should have checked for that. You have to pass a flag to say if the caller holds the lock or not... regards, dan carpenter

[PATCH 1/2] usb: phy: ab8500: silence some uninitialized variable warnings

2018-10-18 Thread Dan Carpenter
Smatch complains that "reg" can be uninitialized if the abx500_get_register_interruptible() call fails. It's an interruptable function, so we should check if the user presses CTRL-C. Signed-off-by: Dan Carpenter --- drivers/usb/phy/phy-ab8500-usb.c | 8 ++-- 1 file change

[PATCH] usb: dwc2: pci: Fix an error code in probe

2018-10-18 Thread Dan Carpenter
We added some error handling to this function but forgot to set the error code on this path. Fixes: ecd29dabb2ba ("usb: dwc2: pci: Handle error cleanup in probe") Signed-off-by: Dan Carpenter --- drivers/usb/dwc2/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/dw

Re: [PATCH -next] USB: cypress_m8: remove set but not used variables 'actual_size, iflag'

2018-10-01 Thread Dan Carpenter
e do. > Commit 9aa8dae7b1fa ("cypress_m8: use usb_fill_int_urb where > appropriate") incorrectly started setting the transfer length to the > size of the buffer. > This is like the third time recently where we've had found a real bug. YueHaibing, could you mention in the commit message where the variable became unused? It would help reviewing. It's not a Fixes tag but it would look like this: "After commit 9aa8dae7b1fa ("cypress_m8: use usb_fill_int_urb where appropriate") then we don't use actual_size any more so that can be removed." regards, dan carpenter

[PATCH] ALSA: usb-audio: ensure that cluster header size is enough

2018-09-22 Thread Dan Carpenter
I think we need a check to make sure that "hc_header.wLength" is large enough for a struct struct uac3_cluster_header_descriptor. Fixes: 9a2fe9b801f5 ("ALSA: usb: initial USB Audio Device Class 3.0 support") Signed-off-by: Dan Carpenter diff --git a/sound/usb/stream.c b/soun

[usb:usb-testing 34/67] drivers/usb/class/usbtmc.c:339 usbtmc_ioctl_abort_bulk_in_tag() error: uninitialized symbol 'actual'.

2018-09-22 Thread Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing head: ae8a2ca8a2215c7e31e6d874f7303801bb15fbbc commit: cbe743f1333b23040d1312afd58224dbd58fcc25 [34/67] usb: usbtmc: Fix ioctl USBTMC_IOCTL_ABORT_BULK_IN New smatch warnings: drivers/usb/class/usbtmc.c:339 usbtm

[usb:usb-testing 21/67] drivers/usb/class/usbtmc.c:1275 usbtmc_ioctl_request() warn: possible memory leak of 'buffer'

2018-09-22 Thread Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing head: ae8a2ca8a2215c7e31e6d874f7303801bb15fbbc commit: 658f24f4523e41cda6a389c38b763f4c0cad6fbc [21/67] usb: usbtmc: Add ioctl for generic requests on control smatch warnings: drivers/usb/class/usbtmc.c:1275 usb

Re: [PATCH] usb: dwc2: Disable all EP's on disconnect

2018-09-20 Thread Dan Carpenter
On Thu, Sep 20, 2018 at 10:21:26AM +, Minas Harutyunyan wrote: > Hi Dan, > > On 9/20/2018 1:49 PM, Dan Carpenter wrote: > > is is obviously deliberate that we drop the other thread's lock and > > then take it ourselves. But I don't think that can be right at al

Re: [PATCH] usb: dwc2: Disable all EP's on disconnect

2018-09-20 Thread Dan Carpenter
Hi Minas, url: https://github.com/0day-ci/linux/commits/Minas-Harutyunyan/usb-dwc2-Disable-all-EP-s-on-disconnect/20180919-104259 base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next smatch warnings: drivers/usb/dwc2/gadget.c:4024 dwc2_hsotg_ep_disable() error: double un

[bug report] usb: host: fotg2: add silicon clock handling

2018-09-12 Thread Dan Carpenter
h adds a dereference 5662 5663 if (!IS_ERR(fotg210->pclk)) 5664 clk_disable_unprepare(fotg210->pclk); 5665 5666 if (!hcd) ^^^ The old code assumes "hcd" can be NULL. 5667 return 0; 5668 regards, dan carpenter

[PATCH] USB: serial: io_ti: array underflow in edge_interrupt_callback()

2018-08-14 Thread Dan Carpenter
A malicious USB device could set port_number to -3 and we would underflow the edge_serial->serial->port[] array. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Dan Carpenter diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 6d1d6efa3055..fa2

[PATCH] xhci: xhci-mem: off by one in xhci_stream_id_to_ring()

2018-07-04 Thread Dan Carpenter
The > should be >= here so that we don't read one element beyond the end of the ep->stream_info->stream_rings[] array. Fixes: e9df17eb1408 ("USB: xhci: Correct assumptions about number of rings per endpoint.") Signed-off-by: Dan Carpenter diff --git a/drivers/usb/ho

[PATCH] USB: serial: ch341: type promotion bug in ch341_control_in()

2018-07-04 Thread Dan Carpenter
341: fix control-message error handling") Signed-off-by: Dan Carpenter diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index bdd7a5ad3bf1..3bb1fff02bed 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -128,7 +128,7 @@ static int ch341_control_i

[PATCH v2] USB: host: ehci-npcm7xx: Fix some error codes in probe

2018-06-27 Thread Dan Carpenter
We accidentally return 1 instead of negative error codes. Fixes: df44831ee2dd ("USB host: Add USB ehci support for nuvoton npcm7xx platform") Signed-off-by: Dan Carpenter --- v2: fix typo in the commit message diff --git a/drivers/usb/host/ehci-npcm7xx.c b/drivers/usb/host/ehci-npcm7

[PATCH] USB: host: ehci-npcm7xx: Fix some error codes in probe

2018-06-26 Thread Dan Carpenter
We accidentally return 1 instead instead the negative error codes. Fixes: df44831ee2dd ("USB host: Add USB ehci support for nuvoton npcm7xx platform") Signed-off-by: Dan Carpenter --- The original patch used the "USB host:" prefix. This is driver code and not generic USB

[PATCH] typec: tcpm: Fix a msecs vs jiffies bug

2018-06-07 Thread Dan Carpenter
The tcpm_set_state() function take msecs not jiffies. Fixes: f0690a25a140 ("staging: typec: USB Type-C Port Manager (tcpm)") Signed-off-by: Dan Carpenter diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c index 8a201dd53d36..0dfd755020f4 100644 --- a/drivers/usb/typec/tc

[bug report] usb: musb: break the huge isr musb_stage0_irq() into small functions

2018-05-31 Thread Dan Carpenter
isconnect(musb); 830 break; 831 case OTG_STATE_A_PERIPHERAL: 832 musb_hnp_stop(musb); regards, dan carpenter -- 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

[bug report] usb: musb: break the huge isr musb_stage0_irq() into small functions

2018-05-30 Thread Dan Carpenter
l %02x", 800 usb_otg_state_string(musb->xceiv->otg->state), devctl); 801 } regards, dan carpenter -- 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 09/11] usb: musb: break the huge isr musb_stage0_irq() into small functions

2018-04-18 Thread Dan Carpenter
On Wed, Apr 18, 2018 at 08:33:52AM -0500, Bin Liu wrote: > Hi Dan, > > I appreciate you scaning the patches and reporting the issues. > These are kbuild stuff so I basically just forward them. It's no effort. > On Wed, Apr 18, 2018 at 10:25:34AM +0300, Dan Carpent

Re: [PATCH 09/11] usb: musb: break the huge isr musb_stage0_irq() into small functions

2018-04-18 Thread Dan Carpenter
Hi Bin, I love your patch! Perhaps something to improve: [auto build test WARNING on balbi-usb/next] [also build test WARNING on v4.17-rc1 next-20180417] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/

Re: [PATCH v4 07/13] staging: typec: tcpci: register port before request irq

2018-03-31 Thread Dan Carpenter
7;s reasonable. Thanks! regards, dan carpenter -- 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 v4 07/13] staging: typec: tcpci: register port before request irq

2018-03-29 Thread Dan Carpenter
rt(chip->tcpci); Can you put the "return err;" back, because that's better style. It's better to keep the error path and success path separate if you can. if (err < 0) { tcpci_unregister_port(chip->tcpci); return err; } return 0; regards, dan carpenter -- 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 v1 3/3] usb: dwc2: Add High Bandwidth ISOC OUT support

2018-03-26 Thread Dan Carpenter
Hi Minas, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on next-20180309] [cannot apply to v4.16-rc4 v4.16-rc3 v4.16-rc2 v4.16-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0d

Re: [bug report] usb: core: Add "quirks" parameter for usbcore

2018-03-23 Thread Dan Carpenter
On Fri, Mar 23, 2018 at 02:16:23PM +0800, Kai-Heng Feng wrote: > Hi Dan, > > Dan Carpenter wrote: > > > Hello Kai-Heng Feng, > > > > This is a semi-automatic email about new static checker warnings. > > I ran Smatch but didn't see the error message:

[bug report] usb: core: Add "quirks" parameter for usbcore

2018-03-22 Thread Dan Carpenter
d = pid, .flags = flags }; 128 } 129 130 if (i < quirk_count) 131 quirk_count = i; 132 133 unlock: 134 mutex_unlock(&quirk_mutex); 135 136 return param_set_copystring(val, kp);

[PATCH] usb: host: ohci-pxa27x: Fix and & vs | typo

2018-02-23 Thread Dan Carpenter
The code is supposed to clear the RH_A_NPS and RH_A_PSM bits, but it's a no-op because of the & vs | typo. This bug predates git and it was only discovered using static analysis so it must not affect too many people in real life. Signed-off-by: Dan Carpenter --- Not tested. dif

Re: [PATCH v2 3/4] Staging: rtl8723bs: Change condition to assignment

2018-01-17 Thread Dan Carpenter
gt; - oldmem == NULL; > + oldmem = NULL; > } > #else This bug would cause a GCC warning if it were ever compiled. This ifdefed code is dead. We should just delete it. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubs

[PATCH] usb: xhci: Clean up error code in xhci_dbc_tty_register_device()

2018-01-09 Thread Dan Carpenter
tty_port_register_device() returns error pointers on error, never NULL. The IS_ERR_OR_NULL() function returns either 1 or 0 so it means we return 1 on error instead of a proper error code. The caller only checks for zero vs non-zero so this doesn't affect runtime. Signed-off-by: Dan Carp

Re: [bug report] usbip: fix stub_rx: harden CMD_SUBMIT path to handle malicious input

2017-12-14 Thread Dan Carpenter
On Thu, Dec 14, 2017 at 11:01:15AM -0700, Shuah Khan wrote: > Hi Dan, > > On 12/14/2017 12:58 AM, Dan Carpenter wrote: > > Hello Shuah Khan, > > > > The patch c6688ef9f297: "usbip: fix stub_rx: harden CMD_SUBMIT path > > to handle malicious input&quo

[bug report] usbip: fix stub_rx: harden CMD_SUBMIT path to handle malicious input

2017-12-14 Thread Dan Carpenter
_buffer_length, 489 GFP_KERNEL); 490 if (!priv->urb->transfer_buffer) { 491 usbip_event_add(ud, SDEV_EVENT_ERROR_MALLOC); 492 return; 493 } 494 } regards, dan carpenter -- To unsubscr

Re: USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer()

2017-12-08 Thread Dan Carpenter
t; > > Would you dare to resend this update suggestion after such a view? > > Of course. That was implied. > No. Greg maintains USB and he's has blocked Markus, because he never listens to feedback but instead just repsonds that he has a different opinion. regards, dan carpenter

Re: USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer()

2017-12-07 Thread Dan Carpenter
so have a special static checker warning for when people do: foo = alloc(); BUG_ON(!foo); People do that occasionally but fortunately it's pretty rare. 10 years ago that's how btrfs did error handling, but now there are only 4 of these still remaining in btrfs. regards, da

Re: USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer()

2017-12-07 Thread Dan Carpenter
and some other part of the system will be killed and fail. Right. > 3. This driver uses GFP_ATOMIC, is that guaranteed to succeed? I think not. > Right again. I was missing the first email in the thread because of my email filters so I didn't see this was atomic. regards, dan carp

Re: USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer()

2017-12-07 Thread Dan Carpenter
what purpose the memory is being allocated; hence when a failure > > occurs they cannot tell what device (or other part of the system) will > > be affected. > > If even allocation of 24 bytes fails, lots of other devices and other parts of > the system will start failing really soon... > Small allocations never fail in the current kernel. regards, dan carpenter -- 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: emi26: Delete an error message for a failed memory allocation in emi26_writememory()

2017-12-06 Thread Dan Carpenter
On Wed, Dec 06, 2017 at 01:12:32PM +0100, Julia Lawall wrote: > > > On Wed, 6 Dec 2017, SF Markus Elfring wrote: > > > From: Markus Elfring > > Date: Wed, 6 Dec 2017 13:03:21 +0100 > > > > Omit an extra message for a memory allocation failure in this function. > > > > This issue was detected by

Re: [PATCH] mmc: vub300: Use common code in __download_offload_pseudocode()

2017-10-31 Thread Dan Carpenter
On Mon, Oct 30, 2017 at 02:03:13PM +0100, Ulf Hansson wrote: > On 30 October 2017 at 13:15, Dan Carpenter wrote: > > On Mon, Oct 30, 2017 at 12:40:39PM +0100, Ulf Hansson wrote: > >> On 27 October 2017 at 21:31, SF Markus Elfring > >> wrote: > >> > From: M

Re: [PATCH] mmc: vub300: Use common code in __download_offload_pseudocode()

2017-10-30 Thread Dan Carpenter
On Mon, Oct 30, 2017 at 12:40:39PM +0100, Ulf Hansson wrote: > On 27 October 2017 at 21:31, SF Markus Elfring > wrote: > > From: Markus Elfring > > Date: Fri, 27 Oct 2017 21:21:40 +0200 > > > > Add a jump target so that a specific string copy operation is stored > > only once at the end of this f

Re: [PATCH] usb: max3421: unlock on error in max3421_hub_control()

2017-10-27 Thread Dan Carpenter
which > > removes the NULL check and add a Reported-by: for me? > It is already in the v2 (and v3) of my initial patch. > https://www.spinics.net/lists/devicetree/msg199901.html > > Should I make a brand new patch (not another version)? Yeah. Greg never rebases once the tree has b

Re: [PATCH] usb: max3421: unlock on error in max3421_hub_control()

2017-10-27 Thread Dan Carpenter
if > the device do not have a platform_data. > In that case, let's drop my patch. Could you send a patch for which removes the NULL check and add a Reported-by: for me? regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a messag

[PATCH] usb: max3421: unlock on error in max3421_hub_control()

2017-10-26 Thread Dan Carpenter
We can't return directly in max3421_hub_control(), we have to unlock first. Fixes: 721fdc83b31b ("usb: max3421: Add devicetree support") Signed-off-by: Dan Carpenter diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c index 928a5aabee02..46a86a7f33

Re: [PATCH 4.14 REGRESSION fix] USB: devio: Revert "USB: devio: Don't corrupt user memory"

2017-10-17 Thread Dan Carpenter
ct other users / the > >kernels memory, it only stops the userspace process making the call > >from shooting itself in the foot. > > Okay, breaking userspace is reason enough all by itself to revert this > change. I didn't realize that libusb sets the buffer_length

[bug report] usb: gadget: R8A66597 peripheral controller support.

2017-10-03 Thread Dan Carpenter
m66592->ep[0].fifosel = M66592_CFIFOSEL; 1651 m66592->ep[0].fifoctr = M66592_CFIFOCTR; 1652 m66592->ep[0].fifotrn = 0; 1653 m66592->ep[0].pipectr = get_pipectr_addr(0); 1654 m66592->pipenum2ep[0] = &m66592->ep[0]; 1655 m66592

Re: [PATCH] usb: misc: usbtest: Fix overflow in usbtest_do_ioctl()

2017-10-01 Thread Dan Carpenter
On Sat, Sep 30, 2017 at 11:04:35AM -0700, Deepa Dinamani wrote: > On Sat, Sep 30, 2017 at 1:15 AM, Dan Carpenter > wrote: > > There used to be a test against "if (param->sglen > MAX_SGLEN)" but it > > was removed during a refactor. It leads to an integer ov

[PATCH] usb: misc: usbtest: Fix overflow in usbtest_do_ioctl()

2017-09-30 Thread Dan Carpenter
eue() as well if "param->iterations" is too high. I don't immediately see that it's harmful but I've added a check to prevent it and silence the static checker warning. Fixes: 18fc4ebdc705 ("usb: misc: usbtest: Remove timeval usage") Signed-off-by: Dan Carpenter

[PATCH v2 1/2] USB: devio: Prevent integer overflow in proc_do_submiturb()

2017-09-22 Thread Dan Carpenter
d270cbfb ("USB: Increase usbfs transfer limit") Signed-off-by: Dan Carpenter --- v2: Cast the ->buffer_length to unsigned int which is more readable than relying on type promotion. diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 318bb3b96687..4664e543cf2f 100644

[PATCH 2/2] USB: devio: Don't corrupt user memory

2017-09-22 Thread Dan Carpenter
The user buffer has "uurb->buffer_length" bytes. If the kernel has more information than that, we should truncate it instead of writing past the end of the user's buffer. I added a WARN_ONCE() to help the user debug the issue. Reported-by: Alan Stern Signed-off-by: Dan Carpen

Re: [PATCH] USB: devio: Prevent integer overflow in proc_do_submiturb()

2017-09-21 Thread Dan Carpenter
On Thu, Sep 21, 2017 at 10:17:03AM -0400, Alan Stern wrote: > On Thu, 21 Sep 2017, Dan Carpenter wrote: > > > There used to be an integer overflow check in proc_do_submiturb() but > > it accidentally got removed. We need to put it back. The > > The removal was de

Re: [PATCH] USB: devio: Prevent integer overflow in proc_do_submiturb()

2017-09-21 Thread Dan Carpenter
On Thu, Sep 21, 2017 at 10:17:03AM -0400, Alan Stern wrote: > On Thu, 21 Sep 2017, Dan Carpenter wrote: > > > There used to be an integer overflow check in proc_do_submiturb() but > > it accidentally got removed. We need to put it back. The > > The removal was de

[PATCH] USB: devio: Prevent integer overflow in proc_do_submiturb()

2017-09-21 Thread Dan Carpenter
_UP(uurb->buffer_length, USB_SG_SIZE); Fixes: 1129d270cbfb ("USB: Increase usbfs transfer limit") Signed-off-by: Dan Carpenter diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 318bb3b96687..f3c9cff2101c 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/c

Re: [PATCH 05/11] mux: Add Intel Cherrytrail USB mux driver

2017-09-02 Thread Dan Carpenter
> + bool vbus_present = false; > > + int i; > > unsigned int i; ? > int i is fine. Static checkers which complain about stuff like that should be uninstalled. > > + > > + for (i = 0; i < ARRAY_SIZE(vbus_cable_ids); i++) { regards, dan carpenter

[bug report] usb: phy: Add USB charger support

2017-08-25 Thread Dan Carpenter
return x->set_power(x, mA); 329 return 0; regards, dan carpenter -- 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: gadget: snps_udc_plat: testing the wrong variable

2017-07-12 Thread Dan Carpenter
"udc->regs" is zero here. We don't set it until a couple lines later. The intent was to test "udc->virt_addr". Fixes: 1b9f35adb0ff ("usb: gadget: udc: Add Synopsys UDC Platform driver") Signed-off-by: Dan Carpenter diff --git a/drivers/usb/gadget/udc/

[bug report] USB: add Freescale high-speed USB SOC device controller driver

2017-06-29 Thread Dan Carpenter
NULL here, but I'm not sure if something else was intended? 918 list_add_tail(&req->queue, &ep->queue); 919 spin_unlock_irqrestore(&udc->lock, flags); 920 921 return 0; regards, dan carpenter -- To unsubscribe from this list: se

[bug report] usbip: vhci-hcd: Set the vhci structure up to work

2017-06-23 Thread Dan Carpenter
^ 1356 vhci->vhci_hcd_ss = NULL; ^ vhci is never initialized. 1357 return ret; 1358 } regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message t

Re: [PATCH] usb: gadget: f_fs: use memdup_user

2017-05-13 Thread Dan Carpenter
gt; - kfree(data); > - return ERR_PTR(-EFAULT); > - } > + data = memdup_user(buf, len); > + if (unlikely(IS_ERR(data))) Don't use likely/unlikely() here. It's not a fast path. regards, dan carpenter -- To unsubscribe from this list: send the line &

[PATCH] usb: gadget: udc-xilinx: clean up a variable name

2017-04-27 Thread Dan Carpenter
"ep->udc->lock" and "udc->lock" are the same thing. It confuses Smatch if we don't use the same name consistently. Signed-off-by: Dan Carpenter diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c index 588e2531b8b8..de2

[bug report] usb: xhci: Add helper function xhci_set_power_on().

2017-04-11 Thread Dan Carpenter
81 spin_lock_irqsave(&xhci->lock, flags); 582 } regards, dan carpenter -- 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

[bug report] usb: gadget: f_hid: fix: Move IN request allocation to set_alt()

2017-01-31 Thread Dan Carpenter
e. 383 free_ep_req(hidg->in_ep, hidg->req); ^ This is also a dereference. 384 /* regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a messa

[bug report] USB: opticon: switch to generic read implementation

2017-01-12 Thread Dan Carpenter
to send RESEND_CTS_STATE on both the failure and success paths. 147 148 /* Request CTS line state, sometimes during opening the current 149 * CTS state can be missed. */ 150 send_control_msg(port, RESEND_CTS_STATE, 1); 151 152 return res;

[bug report] [ARM] ohci-pxa27x: use ioremap() and offset for register access

2016-11-16 Thread Dan Carpenter
166 167 __raw_writel(uhcrhda, pxa_ohci->mmio_base + UHCRHDA); 168 __raw_writel(uhcrhdb, pxa_ohci->mmio_base + UHCRHDB); 169 return 0; 170 } regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of

[patch] usb: xhci-mem: use passed in GFP flags instead of GFP_KERNEL

2016-11-10 Thread Dan Carpenter
We normally use the passed in gfp flags for allocations, it's just these two which were missed. Fixes: 22d45f01a836 ("usb/xhci: replace pci_*_consistent() with dma_*_coherent()") Signed-off-by: Dan Carpenter --- >From static analysis. Not tested. diff --git a/drivers/usb

Re: usbip: vhci extension: modifications to vhci driver

2016-10-12 Thread Dan Carpenter
Smatch sometimes does have false positives because it thinks foo->array is a dereference when really we're taking the address of the array. I should fix that... But it understands that container_of(NULL) is ok. regards, dan carpenter -- To unsubscribe from this list: send the line "u

[bug report] usb: gadget: f_fs: handle control requests not directed to interface or endpoint

2016-10-12 Thread Dan Carpenter
ven clear to me what we are trying to do here. 3156 default: 3157 return (bool) (func->ffs->user_flags & 3158 FUNCTIONFS_ALL_CTRL_RECIP); 3159 } 3160 } regards, dan carpenter -- To unsubscribe from this list: se

re: usbip: vhci extension: modifications to vhci driver

2016-10-11 Thread Dan Carpenter
v_to_vhci() function. 464 unsigned long flags; 465 466 if (!vdev) { ^ Old code assumed "vdev" could be NULL. 467 pr_err("could not get virtual device"); 468 return; regards, dan ca

[patch] usb: gadget: fsl_qe_udc: signedness bug in qe_get_frame()

2016-07-15 Thread Dan Carpenter
We can't assign -EINVAL to a u16. Fixes: 3948f0e0c999 ('usb: add Freescale QE/CPM USB peripheral controller driver') Signed-off-by: Dan Carpenter diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c index 93d28cb..901366f 100644 --- a/drivers

[patch] usb: gadget: fsl_qe_udc: off by one in setup_received_handle()

2016-07-13 Thread Dan Carpenter
The udc->eps[] array has USB_MAX_ENDPOINTS elements so > should be >=. Fixes: 3948f0e0c999 ('usb: add Freescale QE/CPM USB peripheral controller driver') Signed-off-by: Dan Carpenter diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c ind

re: usb: host: Faraday fotg210-hcd driver

2016-06-27 Thread Dan Carpenter
9 maxp *= multi; 3970 3971 stream->buf0 = cpu_to_hc32(fotg210, (epnum << 8) | dev->devnum); 3972 stream->buf1 = cpu_to_hc32(fotg210, buf1); 3973 stream->buf2 = cpu_to_hc32(fotg210, multi); regards, dan carpenter -- To unsubscribe from t

[patch] usb: gadget: f_fs: check for allocation failure

2016-06-24 Thread Dan Carpenter
Return -ENOMEM if kmalloc() fails. Fixes: 9353afbbfa7b ('usb: gadget: f_fs: buffer data from ‘oversized’ OUT requests') Signed-off-by: Dan Carpenter diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index a91fcb0..5c8429f 100644 --- a/drivers/

Re: [patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-28 Thread Dan Carpenter
On Sat, May 28, 2016 at 12:15:24PM +0200, Michal Nazarewicz wrote: > On Sat, May 28 2016, Dan Carpenter wrote: > > Also in the kernel we have to declare variables at the start of the > > block. > > /me shrugs > > I looked at this out of curiosity and there are prec

Re: [patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-28 Thread Dan Carpenter
On Sat, May 28, 2016 at 12:15:24PM +0200, Michal Nazarewicz wrote: > On Sat, May 28 2016, Dan Carpenter wrote: > > Also in the kernel we have to declare variables at the start of the > > block. > > /me shrugs > > I looked at this out of curiosity and there are prec

[patch v2] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-27 Thread Dan Carpenter
This loop is supposed to set all the .num[] values to -1 but it's off by one so it skips the first element and sets one element past the end of the array. I've cleaned up the loop a little as well. Fixes: ddf8abd25994 ('USB: f_fs: the FunctionFS driver') Signed-off-by: D

Re: [patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-27 Thread Dan Carpenter
On Fri, May 27, 2016 at 07:25:30PM +0200, walter harms wrote: > > > Am 27.05.2016 14:23, schrieb Michal Nazarewicz: > > On Fri, May 27 2016, Dan Carpenter wrote: > >> diff --git a/drivers/usb/gadget/function/f_fs.c > >> b/drivers/usb/gadget/function/f_fs.c &

[patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-27 Thread Dan Carpenter
994 ('USB: f_fs: the FunctionFS driver') Signed-off-by: Dan Carpenter --- I just spotted this reviewing the code, I have not tested it. Please review carefully, the vla_ptr() macro is difficult to understand. diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function

[patch] usbnet: smsc95xx: silence an uninitialized variable warning

2016-05-03 Thread Dan Carpenter
If the call to fn() fails then "buf" is uninitialized. Just return the error code in that case. Signed-off-by: Dan Carpenter diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 2edc2bc..d9d2806 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/

[patch] usbnet/smsc75xx: silence uninitialized variable warning

2016-05-03 Thread Dan Carpenter
If the fn() calls fail then "buf" is uninitialized. Just return early in that situation. Signed-off-by: Dan Carpenter diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index c369db9..9af9799 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.

[patch] usb: dwc3: gadget: fix mask and shift order in DWC3_DCFG_NUMP()

2016-05-03 Thread Dan Carpenter
In the original DWC3_DCFG_NUMP() was always zero. It looks like the intent was to shift first and then do the mask. Fixes: 2a58f9c12bb3 ('usb: dwc3: gadget: disable automatic calculation of ACK TP NUMP') Signed-off-by: Dan Carpenter diff --git a/drivers/usb/dwc3/core.h b/driver

Re: [PATCH 2/8] staging: rtl8192u: check return value eprom_read

2016-04-29 Thread Dan Carpenter
ROM_ID = eprom_read(dev, 0); /* first read EEPROM ID out; */ > + ret = eprom_read(dev, 0); /* first read EEPROM ID out; */ > + if (ret) > + return; > + wEPROM_ID = (u16)ret; This is wrong and nonsense. I'm not reviewing the rest of the patch seri

  1   2   3   4   >