Skip to content

Commit

Permalink
target/usb-gadget: strlen() doesn't count the terminator
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Nicholas Bellinger committed Oct 2, 2012
1 parent 8ecf595 commit 232ebe3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/gadget/tcm_usb_gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,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;
Expand Down

0 comments on commit 232ebe3

Please sign in to comment.