[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ffcf3922-1ff9-ed2b-619b-d411a8eb70fc@gmx.de>
Date: Wed, 28 Dec 2022 08:58:08 +0100
From: Helge Deller <deller@....de>
To: yang.yang29@....com.cn
Cc: javierm@...hat.com, tzimmermann@...e.de,
christophe.leroy@...roup.eu, wsa+renesas@...g-engineering.com,
linux-fbdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, xu.panda@....com.cn
Subject: Re: [PATCH linux-next] fbdev: use strscpy() to instead of strncpy()
On 12/28/22 02:44, yang.yang29@....com.cn wrote:
> From: Xu Panda <xu.panda@....com.cn>
>
> 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@....com.cn>
> Signed-off-by: Yang Yang <yang.yang29@....com>
> ---
> drivers/video/fbdev/aty/atyfb_base.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
applied.
Thanks!
Helge
>
> diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
> index 0ccf5d401ecb..851c1236fddb 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, 24);
>
> width = par->lcd_width = *(u16 *)(par->lcd_table+25);
> height = par->lcd_height = *(u16 *)(par->lcd_table+27);
Powered by blists - more mailing lists