Skip to content

Commit 02d487f

Browse files
tititiou36hdeller
authored andcommitted
fbdev: offb: Simplify offb_init_fb()
Turn a strcpy()+strncat()+'\0' into an equivalent snprintf(). Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 7be6adf commit 02d487f

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

drivers/video/fbdev/offb.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,9 @@ static void offb_init_fb(struct platform_device *parent, const char *name,
423423
fix = &info->fix;
424424
var = &info->var;
425425

426-
if (name) {
427-
strcpy(fix->id, "OFfb ");
428-
strncat(fix->id, name, sizeof(fix->id) - sizeof("OFfb "));
429-
fix->id[sizeof(fix->id) - 1] = '\0';
430-
} else
426+
if (name)
427+
snprintf(fix->id, sizeof(fix->id), "OFfb %s", name);
428+
else
431429
snprintf(fix->id, sizeof(fix->id), "OFfb %pOFn", dp);
432430

433431

0 commit comments

Comments
 (0)