Skip to contentSkip to conversation

target: target_core_transport: Don't try to strlen() an integer

PATCH New Mark Brown 1 participant 1 message Sep 2, 2014

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 target: target_core_transport: Don't try to strlen() an integer

In transport_dump_vpd_ident_type() we try to call strlen() on the integer len which is obviously a typo; take the length of the string already in buf instead.

Fixes 6cfa853ceee4a (target: target_core_transport.c: Cleaning up missing null-terminate

in conjunction with strncpy)

---
 drivers/target/target_core_transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_transport.c +1 -1
index 1dd11818f38f..3ce85edc2ea9 100644
@@ -953,7 +953,7 @@ int transport_dump_vpd_ident_type(
 		strlcat(buf, "SCSI name string\n", sizeof(buf));
 		break;
 	default:
-		len = strlen(len);
+		len = strlen(buf);
 		snprintf(&buf[len], sizeof(buf) - len, "Unsupported: 0x%02x\n",
 				vpd->device_identifier_type);
 		ret = -EINVAL;
Signature · 1 line
2.1.0