From 627f192d1e1a2ddf5fb06201facb15d4c70b058f Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 8 Jan 2019 15:00:03 +0100 Subject: dio: Fix buffer overflow in case of unknown board MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With gcc 8.2.0: drivers/dio/dio.c: In function ‘dio_init’: drivers/dio/dio.c:240:17: warning: ‘strcpy’ writing 69 or more bytes into a region of size 64 overflows the destination [-Wstringop-overflow=] strcpy(dev->name,dio_getname(dev->id)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Indeed, if an unknown board is present, the target buffer will overflow. Shorten the unknown board name string to fix this, and declare it as an array while at it. Signed-off-by: Geert Uytterhoeven --- drivers/dio/dio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/dio') diff --git a/drivers/dio/dio.c b/drivers/dio/dio.c index 92e78d16b476..c9aa15fb86a9 100644 --- a/drivers/dio/dio.c +++ b/drivers/dio/dio.c @@ -89,8 +89,8 @@ static struct dioname names[] = #undef DIONAME #undef DIOFBNAME -static const char *unknowndioname - = "unknown DIO board -- please email !"; +static const char unknowndioname[] + = "unknown DIO board, please email linux-m68k@lists.linux-m68k.org"; static const char *dio_getname(int id) { -- cgit v1.2.3-59-g8ed1b