[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] virtio-net: use g_memdup2() instead of unsafe g_memdup()
From: |
Jason Wang |
Subject: |
Re: [PATCH] virtio-net: use g_memdup2() instead of unsafe g_memdup() |
Date: |
Fri, 1 Apr 2022 10:31:14 +0800 |
On Fri, Apr 1, 2022 at 2:29 AM Eugenio Pérez <eperezma@redhat.com> wrote:
>
> Fixing that literal checkpatch.pl because it will complain when we modify the
> file
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> hw/net/virtio-net.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 1067e72b39..e4748a7e6c 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -1443,7 +1443,8 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev,
> VirtQueue *vq)
> }
>
> iov_cnt = elem->out_num;
> - iov2 = iov = g_memdup(elem->out_sg, sizeof(struct iovec) *
> elem->out_num);
> + iov2 = iov = g_memdup2(elem->out_sg,
> + sizeof(struct iovec) * elem->out_num);
> s = iov_to_buf(iov, iov_cnt, 0, &ctrl, sizeof(ctrl));
> iov_discard_front(&iov, &iov_cnt, sizeof(ctrl));
> if (s != sizeof(ctrl)) {
> --
> 2.27.0
>