aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-10-02 04:27:14 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2012-10-02 17:16:21 -0400
commit232ebe34e1a7827c9ddd4f31e95e21ba498ae52c (patch)
treeb2c0246166d9dbff998ae0da442e5049f799351b /drivers/usb
parent8ecf595bc2bb468f567eaa4ea5ffbf5d2c871b94 (diff)
target/usb-gadget: 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 <dan.carpenter@oracle.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/tcm_usb_gadget.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c
index 0f75f23ef661..5662d6e927c0 100644
--- a/drivers/usb/gadget/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/tcm_usb_gadget.c
@@ -1815,7 +1815,7 @@ static ssize_t tcm_usbg_tpg_store_nexus(
1815 ret = tcm_usbg_drop_nexus(tpg); 1815 ret = tcm_usbg_drop_nexus(tpg);
1816 return (!ret) ? count : ret; 1816 return (!ret) ? count : ret;
1817 } 1817 }
1818 if (strlen(page) > USBG_NAMELEN) { 1818 if (strlen(page) >= USBG_NAMELEN) {
1819 pr_err("Emulated NAA Sas Address: %s, exceeds" 1819 pr_err("Emulated NAA Sas Address: %s, exceeds"
1820 " max: %d\n", page, USBG_NAMELEN); 1820 " max: %d\n", page, USBG_NAMELEN);
1821 return -EINVAL; 1821 return -EINVAL;