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

From: Doug Anderson
Date: Thu Aug 03 2017 - 12:39:24 EST


Hi,

On Thu, Aug 3, 2017 at 9:33 AM, Matthias Kaehlcke <mka@xxxxxxxxxxxx> 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@xxxxxxxxxxxx>
> ---
> 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@xxxxxxxxxxxx>