aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorAnton Tikhomirov <av.tikhomirov@samsung.com>2012-02-23 01:38:46 -0500
committerFelipe Balbi <balbi@ti.com>2012-03-02 05:12:04 -0500
commit27a78d6a283d6782438f72306746afe4bf44c215 (patch)
treef4b1e2c44e2bed22e593e7071092c272c25ba1e7 /drivers/usb/dwc3
parent8d62cd65d74d0e241b3a152f7347bb66126b705b (diff)
usb: dwc3: use proper function for setting endpoint name
It's wrong to use the size of array as an argument for strncat. Memory corruption is possible. strlcat is exactly what we need here. Cc: stable@vger.kernel.org Signed-off-by: Anton Tikhomirov <av.tikhomirov@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/gadget.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 48b2d0d14481..60b75c302aa4 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -643,16 +643,16 @@ static int dwc3_gadget_ep_enable(struct usb_ep *ep,
643 643
644 switch (usb_endpoint_type(desc)) { 644 switch (usb_endpoint_type(desc)) {
645 case USB_ENDPOINT_XFER_CONTROL: 645 case USB_ENDPOINT_XFER_CONTROL:
646 strncat(dep->name, "-control", sizeof(dep->name)); 646 strlcat(dep->name, "-control", sizeof(dep->name));
647 break; 647 break;
648 case USB_ENDPOINT_XFER_ISOC: 648 case USB_ENDPOINT_XFER_ISOC:
649 strncat(dep->name, "-isoc", sizeof(dep->name)); 649 strlcat(dep->name, "-isoc", sizeof(dep->name));
650 break; 650 break;
651 case USB_ENDPOINT_XFER_BULK: 651 case USB_ENDPOINT_XFER_BULK:
652 strncat(dep->name, "-bulk", sizeof(dep->name)); 652 strlcat(dep->name, "-bulk", sizeof(dep->name));
653 break; 653 break;
654 case USB_ENDPOINT_XFER_INT: 654 case USB_ENDPOINT_XFER_INT:
655 strncat(dep->name, "-int", sizeof(dep->name)); 655 strlcat(dep->name, "-int", sizeof(dep->name));
656 break; 656 break;
657 default: 657 default:
658 dev_err(dwc->dev, "invalid endpoint transfer type\n"); 658 dev_err(dwc->dev, "invalid endpoint transfer type\n");