Skip to content

Commit

Permalink
fbdev: offb: Simplify offb_init_fb()
Browse files Browse the repository at this point in the history
Turn a strcpy()+strncat()+'\0' into an equivalent snprintf().

Signed-off-by: Christophe JAILLET <[email protected]>
Signed-off-by: Helge Deller <[email protected]>
  • Loading branch information
tititiou36 authored and hdeller committed Nov 7, 2023
1 parent 7be6adf commit 02d487f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/video/fbdev/offb.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,9 @@ static void offb_init_fb(struct platform_device *parent, const char *name,
fix = &info->fix;
var = &info->var;

if (name) {
strcpy(fix->id, "OFfb ");
strncat(fix->id, name, sizeof(fix->id) - sizeof("OFfb "));
fix->id[sizeof(fix->id) - 1] = '\0';
} else
if (name)
snprintf(fix->id, sizeof(fix->id), "OFfb %s", name);
else
snprintf(fix->id, sizeof(fix->id), "OFfb %pOFn", dp);


Expand Down

0 comments on commit 02d487f

Please sign in to comment.