[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 changed, 6

[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
b 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

[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

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 all. > &g

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

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

2018-09-12 Thread Dan Carpenter
ereference 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/host/xh

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

2018-07-04 Thread Dan Carpenter
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_in(str

[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
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
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 Carpenter wr

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:

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

2018-03-31 Thread Dan Carpenter
easonable. 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
ecause 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:

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 <dan.carpen...@oracle.com> wrote: > > > Hello Kai-Heng Feng, > > > > This is a semi-automatic email about new static checker warnings. > > I ran Smatch but didn'

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

2018-03-22 Thread Dan Carpenter
135 136 return param_set_copystring(val, kp); ^^^ Patch adds new dereference (inside the function). 137 } 138 regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body

[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 <dan.carpen...@ora

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

2018-01-17 Thread Dan Carpenter
); > mem = oldmem; > - 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 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 Carpenter

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
490 if (!priv->urb->transfer_buffer) { 491 usbip_event_add(ud, SDEV_EVENT_ERROR_MALLOC); 492 return; 493 } 494 } regards, dan carpenter -- To unsubscribe from this list: send the

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

2017-12-08 Thread Dan Carpenter
(error) message. > > > > 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 opini

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

2017-12-07 Thread Dan Carpenter
er 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, dan carpenter -- To unsubscribe f

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 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
> > for 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 fai

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. >

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 <dan.carpen...@oracle.com> wrote: > > On Mon, Oct 30, 2017 at 12:40:39PM +0100, Ulf Hansson wrote: > >> On 27 October 2017 at 21:31, SF Markus Elfring > >&g

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

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

2017-10-27 Thread Dan Carpenter
> 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 been shared

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

2017-10-27 Thread Dan Carpenter
> 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 message to major

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

2017-10-27 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 <dan.carpen...@oracle.com> diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c in

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

2017-10-17 Thread Dan Carpenter
her 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 to 0 for &

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

2017-10-03 Thread Dan Carpenter
92->ep[0].fifoctr = M66592_CFIFOCTR; 1652 m66592->ep[0].fifotrn = 0; 1653 m66592->ep[0].pipectr = get_pipectr_addr(0); 1654 m66592->pipenum2ep[0] = >ep[0]; 1655 m66592->epaddr2ep[0] = >ep[0]; regards, dan carpenter -- To unsubscribe fr

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 <dan.carpen...@oracle.com> > wrote: > > There used to be a test against "if (param->sglen > MAX_SGLEN)" but it > > was removed during a re

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

2017-09-30 Thread Dan Carpenter
_queue() 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 <dan.carpe

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

2017-09-22 Thread Dan Carpenter
;USB: Increase usbfs transfer limit") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- 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 318bb

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

2017-09-22 Thread Dan Carpenter
.edu> Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 318bb3b96687..4664e543cf2f 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -1571,7 +1576,11 @@ static int proc_do_submiturb(struct u

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
urb->buffer_length, USB_SG_SIZE); Fixes: 1129d270cbfb ("USB: Increase usbfs transfer limit") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 318bb3b96687..f3c9cff2101c 100644 --- a/drivers/usb/core/dev

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
rn 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 <dan.carpen...@oracle.com> diff --gi

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

2017-06-29 Thread Dan Carpenter
e if something else was intended? 918 list_add_tail(>queue, >queue); 919 spin_unlock_irqrestore(>lock, flags); 920 921 return 0; regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a messa

[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 to majord..

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

2017-05-13 Thread Dan Carpenter
(data, buf, len))) { > - 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 f

[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 <dan.carpen...@oracle.com> diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx

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

2017-04-11 Thread Dan Carpenter
>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
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 message to majord...@vger.kernel.

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

2017-01-12 Thread Dan Carpenter
h 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; 153 } regards, dan c

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

2016-11-16 Thread Dan Carpenter
67 __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 a message

[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 <dan.carpen...@oracle.com> --- >From static analysis. Not tested. d

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 "unsubs

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

2016-10-12 Thread Dan Carpenter
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: send the line "un

re: usbip: vhci extension: modifications to vhci driver

2016-10-11 Thread Dan Carpenter
) 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 carpenter --

[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 <dan.carpen...@oracle.com> diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c index 93d28cb..901366f

[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 <dan.carpen...@oracle.com> diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers

re: usb: host: Faraday fotg210-hcd driver

2016-06-27 Thread Dan Carpenter
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 this l

[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 <dan.carpen...@oracle.com> diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index a91fcb0..5c8429f

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: Dan Carpenter <dan.car

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
'USB: f_fs: the FunctionFS driver') Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- 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

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

2016-05-04 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 <dan.carpen...@oracle.com> diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 2edc2bc..d9d2806 100644 --- a/drivers/net/usb/

[patch] usbnet/smsc75xx: silence uninitialized variable warning

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

[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 <dan.carpen...@oracle.com> diff --git a/drivers/us

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

2016-04-29 Thread Dan Carpenter
quot;, __func__); > - wEPROM_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

re: usbip: vudc: Add SysFS infrastructure for VUDC

2016-04-29 Thread Dan Carpenter
lock); 205 status = udc->ud.status; 206 spin_unlock_irq(>ud.lock); 207 208 return snprintf(out, PAGE_SIZE, "%d\n", status); 209 } regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in

Re: usbip: vudc: Add VUDC main file

2016-04-29 Thread Dan Carpenter
Ahh.. Too bad. Thanks for looking at this. 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: usbip: vudc: Add VUDC main file

2016-04-28 Thread Dan Carpenter
excited! But I have no idea if it's a false positive or a real bug. 89 put_vudc_device(udc_dev); 90 } 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 Mo

[patch] usb: gadget: f_midi: unlock on error

2016-04-01 Thread Dan Carpenter
We added some new locking here, but missed an error path where we need to unlock. Fixes: 9acdf4df2fc4 ('usb: gadget: f_midi: added spinlock on transmit function') Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/

[patch -target tree] usb: gadget: f_tcm: use after free

2016-03-02 Thread Dan Carpenter
We need to move the kfree() down a line so we don't dereference a freed variable. Fixes: 1b418a8fcbc0 ('target: Convert demo-mode only drivers to target_alloc_session') Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/

[patch] USB: cxacru: fix an bounds check warning

2016-01-30 Thread Dan Carpenter
This is a privileged operation so it doesn't matter much. We use "tmp" as an offset into an array. If it were invalid we could read out of bounds and trigger an oops if the memory is not mapped. Plus it makes static checkers complain. Signed-off-by: Dan Carpenter <dan.carpen.

re: USB: gadget: add USB Audio Gadget driver

2016-01-29 Thread Dan Carpenter
le16_to_cpu(data)); Doing le16_to_cpu() on a u32 is an endian bug. 374 audio->set_con = NULL; 375 } 376 break; 377 default: 378 break; 379 } 380 } regards,

[patch v2] usb: gadget: f_midi: missing unlock on error path

2016-01-05 Thread Dan Carpenter
We added a new error path to this function and we forgot to drop the lock. Fixes: e1e3d7ec5da3 ('usb: gadget: f_midi: pre-allocate IN requests') Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- v2: Felipe asked for this to be fixed a different way. diff --git a/drivers/usb/

Re: [patch v2] usb: gadget: f_midi: missing unlock on error path

2016-01-05 Thread Dan Carpenter
t;in_port[substream->number]) > + if (substream->number > midi->in_ports) This is off by one. It should be >= midi->in_ports. 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 v2] usb: gadget: f_midi: missing unlock on error path

2016-01-05 Thread Dan Carpenter
ead of after the frees. It's less symetric that way and thus more error prone but it's better for performance. Anyway, I don't think it really matters, this is a minor thing. Also I hope that Smatch will be able to avoid that false positive about the midi dereference by the end of 2016. :)

Re: [patch v2] usb: gadget: f_midi: missing unlock on error path

2016-01-05 Thread Dan Carpenter
It's a false positive, if midi is NULL then i starts as zero so it won't go inside the for loop. Smatch has the same false positive. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kerne

Re: [patch v2] usb: gadget: f_midi: missing unlock on error path

2016-01-05 Thread Dan Carpenter
h is applied to the wrong git tree, please drop us a note to > > help improving the system] > > > > url: > > https://github.com/0day-ci/linux/commits/Dan-Carpenter/usb-gadget-f_midi-missing-unlock-on-error-path/20160105-183115 > > base: https://git.kernel.org/pub

Re: [PATCH v2 RESEND] usb: Use memdup_user to reuse the code

2016-01-04 Thread Dan Carpenter
On Wed, Dec 30, 2015 at 09:15:55AM +, Pathak, Rahul (R.) wrote: > Hello Greg, > > This patch is not yet merged, its already been reviewed and acked by Alan. > Relax. Everyone is on vacation. This stuff is not life or death that it must be done right away. regards, d

[patch] usb: gadget: f_midi: missing unlock on error path

2015-12-21 Thread Dan Carpenter
We added a new error path to this function and we forgot to drop the lock. Fixes: e1e3d7ec5da3 ('usb: gadget: f_midi: pre-allocate IN requests') Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c

Re: [PATCH] USB-FHCI: Use a signed return type for fhci_create_ep()

2015-12-19 Thread Dan Carpenter
Just make it an int. The caller also casts it to u32... 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-FHCI: Use a signed return type for fhci_create_ep()

2015-12-19 Thread Dan Carpenter
must. Otherwise prefer ordinary types. > > > The caller also casts it to u32... > > Do you want to get rid of similar casts in affected functions? If you want, that would be great. I just enjoy complaining generally, though. :P regards, dan carpenter -- To unsubscribe from this lis

[patch] USB: ipaq.c: fix a timeout loop

2015-12-16 Thread Dan Carpenter
The code expects the loop to end with "retries" set to zero but, because it is a post-op, it will end set to -1. I have fixed this by moving the decrement inside the loop. Fixes: 014aa2a3c32e ('USB: ipaq: minor ipaq_open() cleanup.') Signed-off-by: Dan Carpenter <dan.carpen...@orac

[patch] usb: gadget: f_tcm: memory leak on error in tcm_alloc_inst()

2015-12-09 Thread Dan Carpenter
We need to kfree(opts) on error. Also it's nicer to allocate opts before taking the lock. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index ed47e40..0a26a2e 100644 --- a/drivers/usb/

Re: [PATCH] usb: Use memdup_user to reuse the code

2015-12-08 Thread Dan Carpenter
isopkt = memdup_user(iso_frame_desc, isofrmlen); if (IS_ERR(isopkt)) { ret = PTR_ERR(isopkt); isopkt = NULL; goto error; } regards, dan carpenter -- To unsubscribe from this list: send the line &

re: usb: gadget: tcm: factor out f_tcm

2015-12-08 Thread Dan Carpenter
t remove this check. 1150 goto err; 1151 1152 return 0; 1153 err: 1154 kfree(cmd); 1155 return -EINVAL; 1156 } drivers/usb/gadget/function/f_tcm.c:1244 bot_submit_command() warn: bool is not less than zero. regards, dan carpenter -- To unsu

Re: [PATCH v1] usb: devio: Add ioctl to disallow detaching kernel USB drivers.

2015-11-26 Thread Dan Carpenter
interface = actconfig->interface[i]; if (usb_interface_claimed(interface)) { dev_warn(>dev->dev, "usbfs: interface %d claimed by %s while '%s' resets device\n", interface->cur_altsetting->desc.bInterfaceNumber, interface->dev.driver->name, current->comm); return -EACCES; } } } return usb_reset_device(ps->dev); } It still goes over the 80 character limit, but that's cleaner than breaking up the variable. 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: cdc-ether: switch to common CDC parser

2015-09-22 Thread Dan Carpenter
257 } 258 259 } else if (!info->header || !info->u || (!rndis && !info->ether)) { 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: usb: gadget: mv: Add USB 3.0 device driver for Marvell PXA2128 chip.

2015-08-12 Thread Dan Carpenter
On Tue, Aug 11, 2015 at 02:16:59PM -0500, Felipe Balbi wrote: On Tue, Aug 11, 2015 at 10:13:40PM +0300, Dan Carpenter wrote: Hello Yu Xu, The patch 3d4eb9dfa3e8: usb: gadget: mv: Add USB 3.0 device driver for Marvell PXA2128 chip. from Jun 15, 2012, leads to the following static

re: usb: gadget: mv: Add USB 3.0 device driver for Marvell PXA2128 chip.

2015-08-11 Thread Dan Carpenter
break; 1677 } else { 1678 mv_u3d_done(curr_ep, curr_req, status); 1679 } 1680 } regards, dan carpenter -- To unsubscribe from this list: send the line

  1   2   3   4   >