summaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorXu Panda <xu.panda@zte.com.cn>2022-12-28 04:44:11 +0300
committerHelge Deller <deller@gmx.de>2022-12-28 11:00:17 +0300
commit6b90032c73405cd4da29ab914df11fd1be960b99 (patch)
tree38d960c0275cf9734f072c400b81a41c5371ee30 /drivers/video
parent8d8cf163c8d8c93bccf0c70a133309693af9bf61 (diff)
downloadlinux-6b90032c73405cd4da29ab914df11fd1be960b99.tar.xz
fbdev: atyfb: 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')
-rw-r--r--drivers/video/fbdev/aty/atyfb_base.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
index 0ccf5d401ecb..d59215a4992e 100644
--- a/drivers/video/fbdev/aty/atyfb_base.c
+++ b/drivers/video/fbdev/aty/atyfb_base.c
@@ -3192,8 +3192,7 @@ static void aty_init_lcd(struct atyfb_par *par, u32 bios_base)
* which we print to the screen.
*/
id = *(u8 *)par->lcd_table;
- strncpy(model, (char *)par->lcd_table+1, 24);
- model[23] = 0;
+ strscpy(model, (char *)par->lcd_table+1, sizeof(model));
width = par->lcd_width = *(u16 *)(par->lcd_table+25);
height = par->lcd_height = *(u16 *)(par->lcd_table+27);