From: Hannes Reinecke Date: Fri, 25 May 2018 09:04:03 +0000 (+0200) Subject: nvme: fix KASAN warning when parsing host nqn X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=1e5f44616287b24a2c032274d6a5e3690dfd279b;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: Christoph Hellwig --- diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c index 8cb3d73e957d..aa318136460e 100644 --- a/drivers/nvme/host/fabrics.c +++ b/drivers/nvme/host/fabrics.c @@ -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: