Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1703264

Re: [PATCH v2] zram: Rework copy of compressor name in comp_algorithm_store()

From Doug Anderson <dianders@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] zram: Rework copy of compressor name in comp_algorithm_store()
Date 2017-08-03 18:40 +0200
Message-ID <uarkf-2yP-23@gated-at.bofh.it> (permalink)
References <uarkf-2yP-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

On Thu, Aug 3, 2017 at 9:33 AM, Matthias Kaehlcke <mka@chromium.org> wrote:
> comp_algorithm_store() passes the size of the source buffer to strlcpy()
> instead of the destination buffer size. Make it explicit that the two
> buffers have the same size and use strcpy() instead of strlcpy().
> The latter can be done safely since the function ensures that the string
> in the source buffer is terminated.
>
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> ---
> Changes in v2:
> - make destination buffer explicitly of the same size as source buffer
> - use strcpy() instead of strlcpy()
> - updated subject and commit message
>
>  drivers/block/zram/zram_drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Looks great.  Commit message could be explicit that this change fixes
no bugs and is mostly a no-op (strcpy may be slightly faster than
strlcpy), but I guess that's obvious to anyone looking at the patch.

Reviewed-by: Douglas Anderson <dianders@chromium.org>

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH v2] zram: Rework copy of compressor name in comp_algorithm_store() Doug Anderson <dianders@chromium.org> - 2017-08-03 18:40 +0200

csiph-web