Skip to contentSkip to conversation

nvme: fix KASAN warning when parsing host nqn

PATCH New Hannes Reinecke 2 participants 2 messages May 25, 2018 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: fix KASAN warning when parsing host nqn

The host nqn actually is smaller than the space reserved for it, so we should be using strlcpy to keep KASAN happy.

Signed-off-by Hannes Reinecke <hare at suse.com>
---
 drivers/nvme/host/fabrics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/fabrics.c +1 -1
index a5c8ebf24eaa..9961eabb0321 100644
@@ -57,7 +57,7 @@ static struct nvmf_host *nvmf_host_add(const char *hostnqn)
 		goto out_unlock;
 
 	kref_init(&host->ref);
-	memcpy(host->nqn, hostnqn, NVMF_NQN_SIZE);
+	strlcpy(host->nqn, hostnqn, NVMF_NQN_SIZE);
 
 	list_add_tail(&host->list, &nvmf_hosts);
 out_unlock:
Signature · 1 line
2.12.3
maintainer Applied
#1 lore raw

PATCH 1/1 nvme: fix KASAN warning when parsing host nqn

Thanks,

applied to nvme-4.18-2.