Skip to content

Commit

Permalink
floppy: make local variable non-static
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
  • Loading branch information
Villemoes authored and Jiri Kosina committed Dec 8, 2015
1 parent 8e39111 commit bcf4299
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit bcf4299

Please sign in to comment.