From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
To: yang.yang29@zte.com.cn, airlied@redhat.com
Cc: xu.panda@zte.com.cn, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org,
virtualization@lists.linux-foundation.org, kraxel@redhat.com,
gurchetansingh@chromium.org
Subject: Re: [PATCH linux-next] drm/virtio: use strscpy() to instead of strncpy()
Date: Mon, 27 Feb 2023 03:04:29 +0300 [thread overview]
Message-ID: <257f88ec-6bfc-0e91-610a-41a1af8e1180@collabora.com> (raw)
In-Reply-To: <202212070913161959936@zte.com.cn>
On 12/7/22 04:13, 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/gpu/drm/virtio/virtgpu_vq.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
> index 9ff8660b50ad..7d95bc74b307 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_vq.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
> @@ -916,8 +916,7 @@ void virtio_gpu_cmd_context_create(struct virtio_gpu_device *vgdev, uint32_t id,
> cmd_p->hdr.ctx_id = cpu_to_le32(id);
> cmd_p->nlen = cpu_to_le32(nlen);
> cmd_p->context_init = cpu_to_le32(context_init);
> - strncpy(cmd_p->debug_name, name, sizeof(cmd_p->debug_name) - 1);
> - cmd_p->debug_name[sizeof(cmd_p->debug_name) - 1] = 0;
> + strscpy(cmd_p->debug_name, name, sizeof(cmd_p->debug_name));
> virtio_gpu_queue_ctrl_buffer(vgdev, vbuf);
> }
>
Applied to misc-next
--
Best regards,
Dmitry
prev parent reply other threads:[~2023-02-27 0:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-07 1:13 yang.yang29
2023-02-27 0:04 ` Dmitry Osipenko [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=257f88ec-6bfc-0e91-610a-41a1af8e1180@collabora.com \
--to=dmitry.osipenko@collabora.com \
--cc=airlied@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gurchetansingh@chromium.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=xu.panda@zte.com.cn \
--cc=yang.yang29@zte.com.cn \
/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
all inboxes | Powered by JetHome®