net: make iov_to_buf take right size argument in nc_sendv_compat()
PATCH 1/2 net: make iov_to_buf take right size argument in nc_sendv_compat()
We want "buf, sizeof(buf)" here. sizeof(buffer) is the size of a pointer, which is wrong.
Thanks to Paolo for pointing it out.
--- net/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/net.c +1 -1
@@ -700,7 +700,7 @@ static ssize_t nc_sendv_compat(NetClientState *nc, const struct iovec *iov, offset = iov[0 ].iov_len; }else { buffer = buf; - offset =iov_to_buf (iov, iovcnt,0 , buffer,sizeof (buffer)); + offset =iov_to_buf (iov, iovcnt,0 , buf,sizeof (buf)); }if (flags &QEMU_NET_PACKET_FLAG_RAW && nc->info->receive_raw) {
Signature · 1 line
1.9.1
PATCH 2/2 net: free the string returned by object_get_canonical_path_component
The value returned from object_get_canonical_path_component must be freed.
--- net/net.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/net.c +3 -2
@@ -1189,10 +1189,11 @@ void print_net_client(Monitor *mon, NetClientState *nc)monitor_printf (mon,"filters:\n" ); } QTAILQ_FOREACH(nf, &nc->filters, next) { -monitor_printf (mon," - %s: type=%s%s\n" , -object_get_canonical_path_component (OBJECT (nf)), +char *path =object_get_canonical_path_component (OBJECT (nf)); +monitor_printf (mon," - %s: type=%s%s\n" , path,object_get_typename (OBJECT (nf)), nf->info_str); +g_free (path); } }
Signature · 1 line
1.9.1
Quoted 16 lines · Yang Hongyang
We want "buf, sizeof(buf)" here. sizeof(buffer) is the size of a pointer, which is wrong.
Thanks to Paolo for pointing it out.Signed-off-by Yang Hongyang <[email protected]>Cc Jason Wang <[email protected]>Cc Paolo Bonzini <[email protected]>--- net/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/net.c +0
-0
net/net.c static ssize_t nc_sendv_compat(NetClientState *nc, const struct iovec *iov, · line 706
Quoted 8 lines
net/net.c +1
-1@@ -700,7 +700,7 @@ static ssize_t nc_sendv_compat(NetClientState *nc, const struct iovec *iov, offset = iov[0 ].iov_len; }else { buffer = buf; - offset =iov_to_buf (iov, iovcnt,0 , buffer,sizeof (buffer)); + offset =iov_to_buf (iov, iovcnt,0 , buf,sizeof (buf)); }if (flags &QEMU_NET_PACKET_FLAG_RAW && nc->info->receive_raw) {
Both two patches were applied in:
https://github.com/jasowang/qemu/commits/net
Thanks
Quoted 26 lines · Jason Wang
Quoted 23 lines · Yang Hongyang
We want "buf, sizeof(buf)" here. sizeof(buffer) is the size of a pointer, which is wrong.
Thanks to Paolo for pointing it out.Signed-off-by Yang Hongyang <[email protected]>Cc Jason Wang <[email protected]>Cc Paolo Bonzini <[email protected]>--- net/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/net.c +1
-1@@ -700,7 +700,7 @@ static ssize_t nc_sendv_compat(NetClientState *nc, const struct iovec *iov, offset = iov[0 ].iov_len; }else { buffer = buf; - offset =iov_to_buf (iov, iovcnt,0 , buffer,sizeof (buffer)); + offset =iov_to_buf (iov, iovcnt,0 , buf,sizeof (buf)); }
Quoted 7 lines
net/net.c static ssize_t nc_sendv_compat(NetClientState *nc, const struct iovec *iov, · line 706
Quoted 1 line
net/net.c +0
-0if (flags &QEMU_NET_PACKET_FLAG_RAW && nc->info->receive_raw) {Both two patches were applied in:
https://github.com/jasowang/qemu/commits/net
Thanks
Thanks!
Paolo