diff options
| author | Thorsten Blum <thorsten.blum@linux.dev> | 2025-11-23 19:21:02 +0100 |
|---|---|---|
| committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2025-11-29 13:50:25 +0100 |
| commit | f3dc4d9898bc98e3cf569f038d90a5fec7bfc44a (patch) | |
| tree | 46266580c7dcf987e757790479f4de3ff6e5dbb2 /tools/lib/python/kdoc/kdoc_re.py | |
| parent | c909fec69f84b39e63876c69b9df2c178c6b76ba (diff) | |
mtd: sm_ftl: Replace deprecated strncpy with sysfs_emit in sm_attr_show
strncpy() is deprecated [1] for NUL-terminated destination buffers
because it does not guarantee NUL termination. It also unnecessarily
NUL-pads the destination buffer if the source is shorter. Replace it
with sysfs_emit() using the "%.*s" format specifier and supply the
length 'sm_attr->len' to improve sm_attr_show().
Return the number of characters actually written to 'buf' instead of
'sm_attr->len'.
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'tools/lib/python/kdoc/kdoc_re.py')
0 files changed, 0 insertions, 0 deletions
