Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

of: base: use strscpy() to instead of strncpy()

The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL terminated strings.

Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.com>
Link: https://lore.kernel.org/r/202212231039128402297@zte.com.cn
Signed-off-by: Rob Herring <robh@kernel.org>

authored by

Xu Panda and committed by
Rob Herring
a98bf9df 00f2a08c

+1 -2
+1 -2
drivers/of/base.c
··· 1884 1884 { 1885 1885 ap->np = np; 1886 1886 ap->id = id; 1887 - strncpy(ap->stem, stem, stem_len); 1888 - ap->stem[stem_len] = 0; 1887 + strscpy(ap->stem, stem, stem_len + 1); 1889 1888 list_add_tail(&ap->link, &aliases_lookup); 1890 1889 pr_debug("adding DT alias:%s: stem=%s id=%i node=%pOF\n", 1891 1890 ap->alias, ap->stem, ap->id, np);