Skip to content

Commit 8d8cf16

Browse files
Xu Pandahdeller
authored andcommitted
fbdev: omapfb: use strscpy() to instead of strncpy()
The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL-terminated strings. Signed-off-by: Xu Panda <[email protected]> Signed-off-by: Yang Yang <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent 9d8b537 commit 8d8cf16

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/video/fbdev/omap/omapfb_main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,7 @@ static int fbinfo_init(struct omapfb_device *fbdev, struct fb_info *info)
14471447
info->fbops = &omapfb_ops;
14481448
info->flags = FBINFO_FLAG_DEFAULT;
14491449

1450-
strncpy(fix->id, MODULE_NAME, sizeof(fix->id));
1450+
strscpy(fix->id, MODULE_NAME, sizeof(fix->id));
14511451

14521452
info->pseudo_palette = fbdev->pseudo_palette;
14531453

@@ -1573,8 +1573,7 @@ static int omapfb_find_ctrl(struct omapfb_device *fbdev)
15731573

15741574
fbdev->ctrl = NULL;
15751575

1576-
strncpy(name, conf->lcd.ctrl_name, sizeof(name) - 1);
1577-
name[sizeof(name) - 1] = '\0';
1576+
strscpy(name, conf->lcd.ctrl_name, sizeof(name));
15781577

15791578
if (strcmp(name, "internal") == 0) {
15801579
fbdev->ctrl = fbdev->int_ctrl;

0 commit comments

Comments
 (0)