strlen() doesn't count the NULL character, so this test is off by one. The result is that sometimes it can silently chop off the last character of the name. Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> diff --git a/drivers/target/usb-gadget/usb_gadget.c b/drivers/target/usb-gadget/usb_gadget.c index f5e7531..ba62bef 100644 --- a/drivers/target/usb-gadget/usb_gadget.c +++ b/drivers/target/usb-gadget/usb_gadget.c @@ -1830,7 +1830,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; -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html