From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756432AbbLAOyU (ORCPT ); Tue, 1 Dec 2015 09:54:20 -0500 Received: from mail-lf0-f51.google.com ([209.85.215.51]:36131 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755847AbbLAOyT (ORCPT ); Tue, 1 Dec 2015 09:54:19 -0500 From: Rasmus Villemoes To: Jiri Kosina Cc: Rasmus Villemoes , linux-kernel@vger.kernel.org Subject: [PATCH] floppy: make local variable non-static Date: Tue, 1 Dec 2015 15:54:01 +0100 Message-Id: <1448981641-17485-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.6.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There's no reason for temparea to be static, since it's only used for temporary sprintf output. It's not immediately obvious that the output will always fit (in the worst case, the output including '\0' is exactly 32 bytes), so save a future reader from worrying about that. Signed-off-by: Rasmus Villemoes --- drivers/block/floppy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 331363e7de0f..9e251201dd48 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3585,7 +3585,7 @@ static void __init config_types(void) unsigned int type = UDP->cmos; struct floppy_drive_params *params; const char *name = NULL; - static char temparea[32]; + char temparea[32]; if (type < ARRAY_SIZE(default_drive_params)) { params = &default_drive_params[type].params; @@ -3596,7 +3596,8 @@ static void __init config_types(void) allowed_drive_mask &= ~(1 << drive); } else { params = &default_drive_params[0].params; - sprintf(temparea, "unknown type %d (usb?)", type); + snprintf(temparea, sizeof(temparea), + "unknown type %d (usb?)", type); name = temparea; } if (name) { -- 2.6.1