From: Christoph Hellwig <hch@infradead.org>
To: Miko Larsson <mikoxyzzz@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>,
minchan@kernel.org, ngupta@vflare.org, senozhatsky@chromium.org,
axboe@kernel.dk, linux-kernel@vger.kernel.org,
linux-block@vger.kernel.org
Subject: Re: [PATCH 2/2] zram: zram_drv: replace strlcpy with strscpy
Date: Thu, 16 Dec 2021 09:52:39 -0800 [thread overview]
Message-ID: <Ybt8554NZpscKx2K@infradead.org> (raw)
In-Reply-To: <Ybt8wY3U2ETjQijH@infradead.org>
On Thu, Dec 16, 2021 at 09:52:01AM -0800, Christoph Hellwig wrote:
> On Thu, Dec 16, 2021 at 04:00:21PM +0100, Miko Larsson wrote:
> > Thanks for the heads-up! That only seems to apply to the assignment of
> > 'file_name'. The usage of strscpy seems to be correct in the other two
> > cases, though (since they're char arrays.) I suspect I might be wrong
> > though, since my knowledge of C is shabby at best.
>
> The second one also sounds like a case for memdup_nul. That adds a
> memory allocation, but it keeps all the checking nicely encapsulated,
> and the last one should be fine with a plain old mempcy.
sorry, s/memcpy/strcpy/
prev parent reply other threads:[~2021-12-16 17:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 19:21 [PATCH 0/2] zram: zram_drv: Fix some formatting problems Miko Larsson
2021-12-15 19:21 ` [PATCH 1/2] zram: zram_drv: add SPDX license identifiers Miko Larsson
2021-12-16 10:12 ` Christoph Hellwig
2021-12-15 19:21 ` [PATCH 2/2] zram: zram_drv: replace strlcpy with strscpy Miko Larsson
2021-12-16 10:14 ` Christoph Hellwig
2021-12-16 15:00 ` Miko Larsson
2021-12-16 17:52 ` Christoph Hellwig
2021-12-16 17:52 ` Christoph Hellwig [this message]
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=Ybt8554NZpscKx2K@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mikoxyzzz@gmail.com \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=senozhatsky@chromium.org \
/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).