Skip to content

Commit 79cd420

Browse files
Zhiyuan Daitorvalds
authored andcommitted
mm/zswap.c: switch from strlcpy to strscpy
strlcpy is marked as deprecated in Documentation/process/deprecated.rst, and there is no functional difference when the caller expects truncation (when not checking the return value). strscpy is relatively better as it also avoids scanning the whole source string. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Zhiyuan Dai <[email protected]> Cc: Seth Jennings <[email protected]> Cc: Dan Streetman <[email protected]> Cc: Vitaly Wool <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent ca6e51d commit 79cd420

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/zswap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ static struct zswap_pool *zswap_pool_create(char *type, char *compressor)
614614
}
615615
pr_debug("using %s zpool\n", zpool_get_type(pool->zpool));
616616

617-
strlcpy(pool->tfm_name, compressor, sizeof(pool->tfm_name));
617+
strscpy(pool->tfm_name, compressor, sizeof(pool->tfm_name));
618618

619619
pool->acomp_ctx = alloc_percpu(*pool->acomp_ctx);
620620
if (!pool->acomp_ctx) {

0 commit comments

Comments
 (0)