Re: [PATCH 2/2] zram: zram_drv: replace strlcpy with strscpy

From: Christoph Hellwig
Date: Thu Dec 16 2021 - 12:52:11 EST


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.