Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d2f6e26 authored by Vasily Gorbik's avatar Vasily Gorbik Committed by Martin Schwidefsky
Browse files

s390/tape: fix stringop-truncation gcc 8 warnings



Use strlcpy to make sure strings are NUL-terminated. Fixes the following
gcc 8 warning:

inlined from 'register_tape_dev' at drivers/s390/char/tape_class.c:57:2:
./include/linux/string.h:246:9: warning: '__builtin_strncpy' specified
bound 32 equals destination size [-Wstringop-truncation]

Acked-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 3ad4c05a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -54,10 +54,10 @@ struct tape_class_device *register_tape_dev(
	if (!tcd)
		return ERR_PTR(-ENOMEM);

	strncpy(tcd->device_name, device_name, TAPECLASS_NAME_LEN);
	strlcpy(tcd->device_name, device_name, TAPECLASS_NAME_LEN);
	for (s = strchr(tcd->device_name, '/'); s; s = strchr(s, '/'))
		*s = '!';
	strncpy(tcd->mode_name, mode_name, TAPECLASS_NAME_LEN);
	strlcpy(tcd->mode_name, mode_name, TAPECLASS_NAME_LEN);
	for (s = strchr(tcd->mode_name, '/'); s; s = strchr(s, '/'))
		*s = '!';