]> git.sur5r.net Git - u-boot/commitdiff
usb: fsl: Fix NULL terminating issue for usb controller name string
authorRajesh Bhagat <rajesh.bhagat@nxp.com>
Sat, 18 Jun 2016 05:17:10 +0000 (10:47 +0530)
committerMarek Vasut <marex@denx.de>
Fri, 24 Jun 2016 22:57:09 +0000 (00:57 +0200)
Fixes NULL terminating issue for usb controller name string by using
sizeof operator.

Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
drivers/usb/host/ehci-fsl.c

index a43d37de0bc9ee507b5de5bcb2cc0bd882ca5d55..fa916ed77f99882d168d218e41d61950b8a9ae51 100644 (file)
@@ -65,7 +65,8 @@ int ehci_hcd_init(int index, enum usb_init_type init,
                mdelay(5);
        }
        memset(current_usb_controller, '\0', 5);
-       snprintf(current_usb_controller, 4, "usb%d", index+1);
+       snprintf(current_usb_controller, sizeof(current_usb_controller),
+                "usb%d", index+1);
 
        switch (index) {
        case 0: