target: strlen() doesn't count the terminator
Subsystems (2)
PATCH 2/2 target: strlen() doesn't count the terminator
We need to take the terminator into consideration here or the last character gets silently truncated away later.
Signed-off-by Dan Carpenter <[email protected]>
drivers/usb/gadget/tcm_usb_gadget.c +1 -1
@@ -1812,7 +1812,7 @@ static ssize_t tcm_usbg_tpg_store_nexus( ret =tcm_usbg_drop_nexus (tpg);return (!ret) ? count : ret; } -if (strlen (page) >USBG_NAMELEN ) { +if (strlen (page) >=USBG_NAMELEN ) {pr_err ("Emulated NAA Sas Address: %s, exceeds" " max: %d\n" , page,USBG_NAMELEN );return -EINVAL ;
Quoted 10 lines · Dan Carpenter
We need to take the terminator into consideration here or the last character gets silently truncated away later.
Signed-off-by Dan Carpenter <[email protected]>drivers/usb/gadget/tcm_usb_gadget.c +0
-0
drivers/usb/gadget/tcm_usb_gadget.c static ssize_t tcm_usbg_tpg_store_nexus(
Quoted 9 lines
drivers/usb/gadget/tcm_usb_gadget.c +1
-2@@ -1812,7 +1812,7 @@ static ssize_t tcm_usbg_tpg_store_nexus( ret =tcm_usbg_drop_nexus (tpg);return (!ret) ? count : ret; } -if (strlen (page) >USBG_NAMELEN ) { +if (strlen (page) >=USBG_NAMELEN ) {pr_err ("Emulated NAA Sas Address: %s, exceeds" " max: %d\n" , page,USBG_NAMELEN );return -EINVAL ; --
Also applied to for-next.
Thanks Dan !
--nab