usb: fsl: Fix NULL terminating issue for usb controller name string

Fixes NULL terminating issue for usb controller name string by using
sizeof operator.

Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
This commit is contained in:
Rajesh Bhagat 2016-06-18 10:47:10 +05:30 committed by Marek Vasut
parent b66a5c03a0
commit 217d16973d

View 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: