Skip to content

Commit b7c1ee2

Browse files
tobluxtsbogend
authored andcommitted
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: KSPP#88 Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 6a1e6bf commit b7c1ee2

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

arch/mips/loongson64/boardinfo.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include <linux/kobject.h>
3+
#include <linux/string.h>
34
#include <boot_param.h>
45

56
static ssize_t boardinfo_show(struct kobject *kobj,
67
struct kobj_attribute *attr, char *buf)
78
{
8-
char board_manufacturer[64] = {0};
9+
char board_manufacturer[64];
910
char *tmp_board_manufacturer = board_manufacturer;
10-
char bios_vendor[64] = {0};
11+
char bios_vendor[64];
1112
char *tmp_bios_vendor = bios_vendor;
1213

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);
1516

1617
return sprintf(buf,
1718
"Board Info\n"

0 commit comments

Comments
 (0)