From: Helge Deller <deller@gmx.de>
To: yang.yang29@zte.com.cn
Cc: tony@atomide.com, b.zolnierkie@samsung.com, arnd@arndb.de,
yuzhe@nfschina.com, jiapeng.chong@linux.alibaba.com,
guozhengkui@vivo.com, linux-fbdev@vger.kernel.org,
linux-omap@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, xu.panda@zte.com.cn
Subject: Re: [PATCH linux-next] fbdev: omap: use strscpy() to instead of strncpy()
Date: Wed, 28 Dec 2022 08:58:25 +0100 [thread overview]
Message-ID: <10b15ff6-0671-a523-a708-76f1dfa0383e@gmx.de> (raw)
In-Reply-To: <202212280940017919910@zte.com.cn>
On 12/28/22 02:40, yang.yang29@zte.com.cn wrote:
> From: Xu Panda <xu.panda@zte.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@zte.com.cn>
> Signed-off-by: Yang Yang <yang.yang29@zte.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;
prev parent reply other threads:[~2022-12-28 7:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-28 1:40 [PATCH linux-next] fbdev: omap: use strscpy() to instead of strncpy() yang.yang29
2022-12-28 7:58 ` Helge Deller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10b15ff6-0671-a523-a708-76f1dfa0383e@gmx.de \
--to=deller@gmx.de \
--cc=arnd@arndb.de \
--cc=b.zolnierkie@samsung.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=guozhengkui@vivo.com \
--cc=jiapeng.chong@linux.alibaba.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=tony@atomide.com \
--cc=xu.panda@zte.com.cn \
--cc=yang.yang29@zte.com.cn \
--cc=yuzhe@nfschina.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).