From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH] nvme: fix KASAN warning when parsing host nqn
Date: Mon, 14 May 2018 14:44:14 +0200 [thread overview]
Message-ID: <20180514124414.GA25689@lst.de> (raw)
In-Reply-To: <20180514122312.62068-1-hare@suse.de>
On Mon, May 14, 2018@02:23:12PM +0200, Hannes Reinecke wrote:
> - host = kmalloc(sizeof(*host), GFP_KERNEL);
> + host = kzalloc(sizeof(*host), GFP_KERNEL);
> if (!host)
> goto out_unlock;
>
> kref_init(&host->ref);
> - memcpy(host->nqn, hostnqn, NVMF_NQN_SIZE);
> + memcpy(host->nqn, hostnqn, strlen(hostnqn));
That pattern is called strcpy :) And we better use strlcpy here,
just in case.
next prev parent reply other threads:[~2018-05-14 12:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-14 12:23 [PATCH] nvme: fix KASAN warning when parsing host nqn Hannes Reinecke
2018-05-14 12:44 ` Christoph Hellwig [this message]
2018-05-25 8:53 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2018-05-25 9:04 Hannes Reinecke
2018-05-25 13:48 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180514124414.GA25689@lst.de \
--to=hch@lst.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).