diff options
author | Jorgen Lundman <[email protected]> | 2020-06-08 03:42:12 +0900 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-07 11:42:12 -0700 |
commit | c9e319faae9677aa0dddfbf9973b9e8fc3feb06c (patch) | |
tree | 3d6677913e5f26d91b7f35bcb62b9b354287db61 /module/zfs/zio.c | |
parent | 60265072e02049be708f74cf0865eba2434a2d85 (diff) |
Replace sprintf()->snprintf() and strcpy()->strlcpy()
The strcpy() and sprintf() functions are deprecated on some platforms.
Care is needed to ensure correct size is used. If some platforms
miss snprintf, we can add a #define to sprintf, likewise strlcpy().
The biggest change is adding a size parameter to zfs_id_to_fuidstr().
The various *_impl_get() functions are only used on linux and have
not yet been updated.
Reviewed by: Sean Eric Fagan <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Jorgen Lundman <[email protected]>
Closes #10400
Diffstat (limited to 'module/zfs/zio.c')
-rw-r--r-- | module/zfs/zio.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/module/zfs/zio.c b/module/zfs/zio.c index b9a3ddcf2..0de502cee 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -203,11 +203,13 @@ zio_init(void) if (align != 0) { char name[36]; - (void) sprintf(name, "zio_buf_%lu", (ulong_t)size); + (void) snprintf(name, sizeof (name), "zio_buf_%lu", + (ulong_t)size); zio_buf_cache[c] = kmem_cache_create(name, size, align, NULL, NULL, NULL, NULL, NULL, cflags); - (void) sprintf(name, "zio_data_buf_%lu", (ulong_t)size); + (void) snprintf(name, sizeof (name), "zio_data_buf_%lu", + (ulong_t)size); zio_data_buf_cache[c] = kmem_cache_create(name, size, align, NULL, NULL, NULL, NULL, data_alloc_arena, data_cflags); |