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

MIPS: Loongson64: Replace deprecated strcpy() with strscpy_pad()

strcpy() is deprecated; use strscpy_pad() instead.

strscpy_pad() already copies the source strings and zero-pads the tail
of the destination buffers, making the explicit initializations to zero
redundant. Remove them to ensure the buffers are only written to once.

No functional changes intended.

Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Thorsten Blum and committed by
Thomas Bogendoerfer
b7c1ee2d 6a1e6bf9

+5 -4
+5 -4
arch/mips/loongson64/boardinfo.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <linux/kobject.h> 3 + #include <linux/string.h> 3 4 #include <boot_param.h> 4 5 5 6 static ssize_t boardinfo_show(struct kobject *kobj, 6 7 struct kobj_attribute *attr, char *buf) 7 8 { 8 - char board_manufacturer[64] = {0}; 9 + char board_manufacturer[64]; 9 10 char *tmp_board_manufacturer = board_manufacturer; 10 - char bios_vendor[64] = {0}; 11 + char bios_vendor[64]; 11 12 char *tmp_bios_vendor = bios_vendor; 12 13 13 - strcpy(board_manufacturer, eboard->name); 14 - strcpy(bios_vendor, einter->description); 14 + strscpy_pad(board_manufacturer, eboard->name); 15 + strscpy_pad(bios_vendor, einter->description); 15 16 16 17 return sprintf(buf, 17 18 "Board Info\n"