[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <10b15ff6-0671-a523-a708-76f1dfa0383e@gmx.de>
Date: Wed, 28 Dec 2022 08:58:25 +0100
From: Helge Deller <deller@....de>
To: yang.yang29@....com.cn
Cc: tony@...mide.com, b.zolnierkie@...sung.com, arnd@...db.de,
yuzhe@...china.com, jiapeng.chong@...ux.alibaba.com,
guozhengkui@...o.com, linux-fbdev@...r.kernel.org,
linux-omap@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, xu.panda@....com.cn
Subject: Re: [PATCH linux-next] fbdev: omap: use strscpy() to instead of
strncpy()
On 12/28/22 02:40, 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/omap/omapfb_main.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
applied.
Thanks!
Helge
>
> 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;
Powered by blists - more mailing lists