diff options
author | Xu Panda <xu.panda@zte.com.cn> | 2022-12-28 04:40:01 +0300 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2022-12-28 11:00:16 +0300 |
commit | 8d8cf163c8d8c93bccf0c70a133309693af9bf61 (patch) | |
tree | 3c1a8905c7e53a7c4558e6d1489e257e051b80d8 /drivers/video/fbdev/omap | |
parent | 9d8b5376cc2848ca22314fdec9a7a45b1bf69189 (diff) | |
download | linux-8d8cf163c8d8c93bccf0c70a133309693af9bf61.tar.xz |
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 <xu.panda@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'drivers/video/fbdev/omap')
-rw-r--r-- | drivers/video/fbdev/omap/omapfb_main.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/video/fbdev/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c index 17cda5765683..1f3df2055ff0 100644 --- a/drivers/video/fbdev/omap/omapfb_main.c +++ b/drivers/video/fbdev/omap/omapfb_main.c @@ -1447,7 +1447,7 @@ static int fbinfo_init(struct omapfb_device *fbdev, struct fb_info *info) info->fbops = &omapfb_ops; info->flags = FBINFO_FLAG_DEFAULT; - strncpy(fix->id, MODULE_NAME, sizeof(fix->id)); + strscpy(fix->id, MODULE_NAME, sizeof(fix->id)); info->pseudo_palette = fbdev->pseudo_palette; @@ -1573,8 +1573,7 @@ static int omapfb_find_ctrl(struct omapfb_device *fbdev) fbdev->ctrl = NULL; - strncpy(name, conf->lcd.ctrl_name, sizeof(name) - 1); - name[sizeof(name) - 1] = '\0'; + strscpy(name, conf->lcd.ctrl_name, sizeof(name)); if (strcmp(name, "internal") == 0) { fbdev->ctrl = fbdev->int_ctrl; |