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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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:
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
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
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:
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'
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
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
);
> 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
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
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
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
(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
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
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
> > 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
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.
>
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
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
> 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
> 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
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
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
&
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
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
_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
;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
.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
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
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
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
> + 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
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
"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
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
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..
(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
"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
>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
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.
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
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
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
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
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
) 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
--
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
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
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
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
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
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
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
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
&
'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
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/
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
+
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
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
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
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
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
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/
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/
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.
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,
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/
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
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. :)
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
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
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
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
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
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
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
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/
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 &
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
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
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
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
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 - 100 of 306 matches
Mail list logo