* [PATCH] virtio-net: use g_memdup2() instead of unsafe g_memdup()
@ 2022-03-31 18:29 Eugenio Pérez
2022-04-01 2:31 ` Jason Wang
0 siblings, 1 reply; 4+ messages in thread
From: Eugenio Pérez @ 2022-03-31 18:29 UTC (permalink / raw)
To: qemu-devel; +Cc: Jason Wang, Michael S. Tsirkin
Fixing that literal checkpatch.pl because it will complain when we modify the file
Signed-off-by: Eugenio Pérez <eperezma@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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio-net: use g_memdup2() instead of unsafe g_memdup()
2022-03-31 18:29 [PATCH] virtio-net: use g_memdup2() instead of unsafe g_memdup() Eugenio Pérez
@ 2022-04-01 2:31 ` Jason Wang
2022-04-01 10:31 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 4+ messages in thread
From: Jason Wang @ 2022-04-01 2:31 UTC (permalink / raw)
To: Eugenio Pérez; +Cc: qemu-devel, Michael S. Tsirkin
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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio-net: use g_memdup2() instead of unsafe g_memdup()
2022-04-01 2:31 ` Jason Wang
@ 2022-04-01 10:31 ` Philippe Mathieu-Daudé
2022-04-01 10:52 ` Eugenio Perez Martin
0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-04-01 10:31 UTC (permalink / raw)
To: Jason Wang, Eugenio Pérez; +Cc: qemu-devel, Michael S. Tsirkin
On 1/4/22 04:31, Jason Wang wrote:
> 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
See https://www.mail-archive.com/qemu-devel@nongnu.org/msg834178.html
>> 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
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio-net: use g_memdup2() instead of unsafe g_memdup()
2022-04-01 10:31 ` Philippe Mathieu-Daudé
@ 2022-04-01 10:52 ` Eugenio Perez Martin
0 siblings, 0 replies; 4+ messages in thread
From: Eugenio Perez Martin @ 2022-04-01 10:52 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: Jason Wang, qemu-devel, Michael S. Tsirkin
On Fri, Apr 1, 2022 at 12:31 PM Philippe Mathieu-Daudé
<philippe.mathieu.daude@gmail.com> wrote:
>
> On 1/4/22 04:31, Jason Wang wrote:
> > 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
>
> See https://www.mail-archive.com/qemu-devel@nongnu.org/msg834178.html
>
Sorry I missed that series. It performs more replacements so regarding
virtio it's better to push yours.
Thanks!
> >> 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
> >>
> >
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-01 10:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-31 18:29 [PATCH] virtio-net: use g_memdup2() instead of unsafe g_memdup() Eugenio Pérez
2022-04-01 2:31 ` Jason Wang
2022-04-01 10:31 ` Philippe Mathieu-Daudé
2022-04-01 10:52 ` Eugenio Perez Martin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.