zfs/module/zcommon
Richard Yao 303678350a
Convert some sprintf() calls to kmem_scnprintf()
These `sprintf()` calls are used repeatedly to write to a buffer. There
is no protection against overflow other than reviewers explicitly
checking to see if the buffers are big enough. However, such issues are
easily missed during review and when they are missed, we would rather
stop printing rather than have a buffer overflow, so we convert these
functions to use `kmem_scnprintf()`. The Linux kernel provides an entire
page for module parameters, so we are safe to write up to PAGE_SIZE.

Removing `sprintf()` from these functions removes the last instances of
`sprintf()` usage in our platform-independent kernel code. This improves
XNU kernel compatibility because the XNU kernel does not support
(removed support for?) `sprintf()`.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14209
2022-11-28 13:49:58 -08:00
..
cityhash.c Compile cityhash code into libzfs 2020-03-27 09:11:22 -07:00
zfeature_common.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_comutil.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_deleg.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_fletcher.c Convert some sprintf() calls to kmem_scnprintf() 2022-11-28 13:49:58 -08:00
zfs_fletcher_aarch64_neon.c Forbid b{copy,zero,cmp}(). Don't include <strings.h> for <string.h> 2022-03-15 15:13:48 -07:00
zfs_fletcher_avx512.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_fletcher_intel.c Forbid b{copy,zero,cmp}(). Don't include <strings.h> for <string.h> 2022-03-15 15:13:48 -07:00
zfs_fletcher_sse.c Forbid b{copy,zero,cmp}(). Don't include <strings.h> for <string.h> 2022-03-15 15:13:48 -07:00
zfs_fletcher_superscalar.c Forbid b{copy,zero,cmp}(). Don't include <strings.h> for <string.h> 2022-03-15 15:13:48 -07:00
zfs_fletcher_superscalar4.c Forbid b{copy,zero,cmp}(). Don't include <strings.h> for <string.h> 2022-03-15 15:13:48 -07:00
zfs_namecheck.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_prop.c dsl_prop_known_index(): check for invalid prop 2022-11-08 10:16:01 -08:00
zpool_prop.c Allow to control failfast 2022-11-10 13:37:12 -08:00
zprop_common.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00