Re: [PATCH V2] util: Remove redundant checks in the openpty()

2021-09-14 Thread Alex Chen
dereferenced at the beginning of the > openpty(). > So the checks on amaster and aslave in the openpty() are redundant. Remove > them. > > Reported-by: Euler Robot > Signed-off-by: Alex Chen > Reviewed-by: Peter Maydell > --- > util/qemu-openpty.c | 7 +++ > 1 f

Re: [PATCH] .mailmap: Fix more contributor entries

2021-08-20 Thread Alex Chen
On 2021/8/20 16:04, Philippe Mathieu-Daudé wrote: > These authors have some incorrect author email field. > For each of them, there is one commit with the replaced > entry. > > Cc: Alex Chen > Cc: Bibo Mao > Cc: Guoyi Tu > Cc: Haibin Zhang > Cc: Hyman Huang > C

[PATCH] virtiofsd: Remove useless code about send_notify_iov

2020-12-14 Thread Alex Chen
ed-off-by: Alex Chen --- tools/virtiofsd/fuse_lowlevel.c | 98 - 1 file changed, 98 deletions(-) diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c index d4119e92ab..e94b71110b 100644 --- a/tools/virtiofsd/fuse_lowlevel.c +++ b/tools/vir

Re: [PATCH] virtiofsd: Fix potential NULL pointer dereference in virtio_send_msg()

2020-12-11 Thread Alex Chen
Hi Dave, On 2020/12/11 2:00, Dr. David Alan Gilbert wrote: > * Alex Chen (alex.c...@huawei.com) wrote: >> The 'ch' will be NULL in the following stack: >> send_notify_iov()->fuse_send_msg()->virtio_send_msg(), >> so we should check 'ch' is valid before dereferencing

[PATCH] virtiofsd: Fix potential NULL pointer dereference in virtio_send_msg()

2020-12-10 Thread Alex Chen
The 'ch' will be NULL in the following stack: send_notify_iov()->fuse_send_msg()->virtio_send_msg(), so we should check 'ch' is valid before dereferencing it Reported-by: Euler Robot Signed-off-by: Alex Chen --- tools/virtiofsd/fuse_virtio.c | 2 ++ 1 file changed, 2 insertions(+) diff

[PATCH] block/nvme: Fix possible array index out of bounds in nvme_process_completion()

2020-12-08 Thread Alex Chen
The range of 'cid' is [1, NVME_QUEUE_SIZE-1], so when 'cid' is equal to NVME_QUEUE_SIZE, it should be continued, otherwise it will lead to array index out of bounds when accessing 'q->reqs[cid-1]' Reported-by: Euler Robot Signed-off-by: Alex Chen --- block/nvme.c | 2 +- 1 file changed

[PATCH v3] qemu-nbd: Fix a memleak in nbd_client_thread()

2020-12-08 Thread Alex Chen
When the qio_channel_socket_connect_sync() fails we should goto 'out_socket' label to free the 'sioc' instead of goto 'out' label. In addition, there's a lot of redundant code in the successful branch and the error branch, optimize it. Reported-by: Euler Robot Signed-off-by: Alex Chen Signed

Re: [PATCH v2] qemu-nbd: Fix a memleak in nbd_client_thread()

2020-12-08 Thread Alex Chen
On 2020/12/8 21:41, Vladimir Sementsov-Ogievskiy wrote: > 03.12.2020 16:58, Alex Chen wrote: >> When the qio_channel_socket_connect_sync() fails >> we should goto 'out_socket' label to free the 'sioc' instead of >> goto 'out' label. >> In addition, there's a lot of redun

[PATCH v2] qemu-nbd: Fix a memleak in nbd_client_thread()

2020-12-03 Thread Alex Chen
When the qio_channel_socket_connect_sync() fails we should goto 'out_socket' label to free the 'sioc' instead of goto 'out' label. In addition, there's a lot of redundant code in the successful branch and the error branch, optimize it. Reported-by: Euler Robot Signed-off-by: Alex Chen Signed

[PATCH] readline: Fix possible array index out of bounds in readline_hist_add()

2020-12-03 Thread Alex Chen
When the 'cmdline' is the last entry in 'rs->history' array, there is no need to put this entry to the end of the array, partly because it is the last entry, and partly because the next operition will lead to array index out of bounds. Reported-by: Euler Robot Signed-off-by: Alex Chen --- u

Re: [PATCH] qemu-nbd: Fix a memleak in nbd_client_thread()

2020-12-01 Thread Alex Chen
On 2020/12/2 4:15, Eric Blake wrote: > On 12/1/20 12:13 AM, Alex Chen wrote: >> When the qio_channel_socket_connect_sync() fails >> we should goto 'out_socket' label to free the 'sioc' instead of >> goto 'out' label. >> In addition, now the 'out' label is useless

[PATCH] qemu-nbd: Fix a memleak in nbd_client_thread()

2020-11-30 Thread Alex Chen
When the qio_channel_socket_connect_sync() fails we should goto 'out_socket' label to free the 'sioc' instead of goto 'out' label. In addition, now the 'out' label is useless, delete it. Reported-by: Euler Robot Signed-off-by: Alex Chen --- qemu-nbd.c | 3 +-- 1 file changed, 1 insertion(+), 2

[PATCH] qemu-nbd: Fix a memleak in qemu_nbd_client_list()

2020-11-30 Thread Alex Chen
When the qio_channel_socket_connect_sync() fails we should goto 'out' label to free the 'sioc' instead of return. Reported-by: Euler Robot Signed-off-by: Alex Chen --- qemu-nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index a7075c5419

Re: [PATCH] contrib/rdmacm-mux: Fix error condition in hash_tbl_search_fd_by_ifid()

2020-11-30 Thread Alex Chen
On 2020/11/30 2:35, Marcel Apfelbaum wrote: > Hi Alex, > > On Wed, Nov 25, 2020 at 3:17 AM Alex Chen <mailto:alex.c...@huawei.com>> wrote: > > On 2020/11/24 23:29, Peter Maydell wrote: > > On Tue, 24 Nov 2020 at 12:15, Alex Chen <ma

Re: [PATCH] virtfs-proxy-helper: Fix a resource leak in main()

2020-11-26 Thread Alex Chen
Hi Greg, Thanks for your review. On 2020/11/26 20:07, Greg Kurz wrote: > On Thu, 26 Nov 2020 10:16:24 + > Alex Chen wrote: > >> Only one of the options -s and -f can be used. When -f is used, >> the fd is created externally and does not need to be closed. > >

Re: [PATCH] virtfs-proxy-helper: Fix a resource leak in main()

2020-11-26 Thread Alex Chen
On 2020/11/26 18:50, Li Qiang wrote: > Alex Chen >> >> Only one of the options -s and -f can be used. When -f is used, >> the fd is created externally and does not need to be closed. >> When -s is used, a new socket fd is created, and this socket fd >> need

[PATCH 3/5] i.MX6: Fix bad printf format specifiers

2020-11-26 Thread Alex Chen
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int". Reported-by: Euler Robot Signed-off-by: Alex Chen --- hw/misc/imx6_ccm.c | 20 ++-- hw/misc/imx6_src.c | 2 +- 2 files changed, 11 insertions(+), 11

[PATCH 2/5] i.MX31: Fix bad printf format specifiers

2020-11-26 Thread Alex Chen
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int". Reported-by: Euler Robot Signed-off-by: Alex Chen --- hw/misc/imx31_ccm.c | 14 +++--- hw/misc/imx_ccm.c | 4 ++-- 2 files changed, 9 insertions(+), 9 dele

[PATCH 4/5] i.MX6ul: Fix bad printf format specifiers

2020-11-26 Thread Alex Chen
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int". Reported-by: Euler Robot Signed-off-by: Alex Chen --- hw/misc/imx6ul_ccm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/misc/imx6ul_ccm.

[PATCH 5/5] misc/omap_sdrc: Fix bad printf format specifiers

2020-11-26 Thread Alex Chen
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int". Reported-by: Euler Robot Signed-off-by: Alex Chen --- hw/misc/omap_sdrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/omap_sdrc

[PATCH 1/5] i.MX25: Fix bad printf format specifiers

2020-11-26 Thread Alex Chen
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int". Reported-by: Euler Robot Signed-off-by: Alex Chen --- hw/misc/imx25_ccm.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/misc/imx

[PATCH 0/5] hw/misc: Fix some bad printf format specifiers

2020-11-26 Thread Alex Chen
Find a lot of bad printf format specifiers in hw/misc, fix them. Alex Chen (5): i.MX25: Fix bad printf format specifiers i.MX31: Fix bad printf format specifiers i.MX6: Fix bad printf format specifiers i.MX6ul: Fix bad printf format specifiers misc/omap_sdrc: Fix bad printf format

[PATCH] virtfs-proxy-helper: Fix a resource leak in main()

2020-11-26 Thread Alex Chen
Only one of the options -s and -f can be used. When -f is used, the fd is created externally and does not need to be closed. When -s is used, a new socket fd is created, and this socket fd needs to be closed at the end of main(). Reported-by: Euler Robot Signed-off-by: Alex Chen --- fsdev

[PATCH] vnc: Fix a memleak in vnc_display_connect()

2020-11-25 Thread Alex Chen
Free the 'sioc' when the qio_channel_socket_connect_sync() fails. Reported-by: Euler Robot Signed-off-by: Alex Chen --- ui/vnc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/vnc.c b/ui/vnc.c index 49235056f7..dae56e9493 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3743,6 +3743,7

[PATCH] test-qga: fix a resource leak in test_qga_guest_get_osinfo()

2020-11-25 Thread Alex Chen
The fixture->fd is created in fixture_setup() and, likewise, needs to be closed in fixture_tear_down(). Reported-by: Euler Robot Signed-off-by: Alex Chen --- tests/test-qga.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test-qga.c b/tests/test-qga.c index c1b173b3cb..eb33264

[PATCH v3] vhost-user-scsi: Fix memleaks in vus_proc_req()

2020-11-24 Thread Alex Chen
-off-by: Alex Chen Reviewed-by: Raphael Norwitz --- contrib/vhost-user-scsi/vhost-user-scsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c index 0f9ba4b2a2..4639440a70 100644

Re: [PATCH v2] vhost-user-scsi: Fix memleaks in vus_proc_req()

2020-11-24 Thread Alex Chen
Sorry, I forgot to add the Reviewed-by information, I will send patch v3. On 2020/11/25 9:25, Alex Chen wrote: > The 'elem' is allocated memory in vu_queue_pop(), and its memory should be > freed in all error branches after vu_queue_pop(). > In addition, in order to free the 'elem' memor

[PATCH v2] vhost-user-scsi: Fix memleaks in vus_proc_req()

2020-11-24 Thread Alex Chen
-off-by: Alex Chen --- contrib/vhost-user-scsi/vhost-user-scsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c index 0f9ba4b2a2..4639440a70 100644 --- a/contrib/vhost-user-scsi/vhost-user

Re: [PATCH] vhost-user-scsi: Fix memleaks in vus_proc_req()

2020-11-24 Thread Alex Chen
On 2020/11/24 23:37, Raphael Norwitz wrote: > On Tue, Nov 24, 2020 at 9:50 AM Alex Chen wrote: >> >> The 'elem' is allocated memory in vu_queue_pop(), and it's memory should be >> freed in all error branchs after vu_queue_pop(). > > s/branchs/branches > >>

Re: [PATCH] contrib/rdmacm-mux: Fix error condition in hash_tbl_search_fd_by_ifid()

2020-11-24 Thread Alex Chen
On 2020/11/24 23:29, Peter Maydell wrote: > On Tue, 24 Nov 2020 at 12:15, Alex Chen wrote: >> >> Hi everyone, >> >> Who can help me merge this patch into the master branch? This patch may be >> need for qemu-5.2 > > This code has been like this since 201

[PATCH] vhost-user-scsi: Fix memleaks in vus_proc_req()

2020-11-24 Thread Alex Chen
-by: Alex Chen --- contrib/vhost-user-scsi/vhost-user-scsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c index 0f9ba4b2a2..4639440a70 100644 --- a/contrib/vhost-user-scsi/vhost-user-scsi.c

Re: [PATCH] contrib/rdmacm-mux: Fix error condition in hash_tbl_search_fd_by_ifid()

2020-11-24 Thread Alex Chen
Hi everyone, Who can help me merge this patch into the master branch? This patch may be need for qemu-5.2 Thanks, Alex On 2020/11/4 0:35, Marcel Apfelbaum wrote: > Hi Alex, > > On Thu, Oct 29, 2020 at 3:43 PM AlexChen > wrote: > > When fd is not found

[PATCH v2 2/2] display/vmware_vga: Replace fprintf(stderr, "*\n") with error_report()

2020-11-19 Thread Alex Chen
Replace all fprintf(stderr...) calls in hw/display/vmware_vga.c witherror_report(). Remove the "\n" from strings passed to all modified calls, since error_report() appends one. Signed-off-by: Alex Chen --- hw/display/vmware_vga.c | 23 --- 1 file changed, 12

[PATCH v2 1/2] display/vmware_vga: Fix bad printf format specifiers

2020-11-19 Thread Alex Chen
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int". Reported-by: Euler Robot Signed-off-by: Alex Chen Reviewed-by: Philippe Mathieu-Daudé --- hw/display/vmware_vga.c | 2 +- 1 file changed, 1 insertion(+), 1 deleti

[PATCH v2 0/2] Optimized some code for display/vmware_vga

2020-11-19 Thread Alex Chen
Optimized some code for vmware_vga: patch1 fixes a bad printf format specifier and patch2 replaces fprintf(stderr, "*\n") with error_report() Alex Chen (2): display/vmware_vga: Fix bad printf format specifiers display/vmware_vga: Replace fprintf(stderr, "*\n") with error_r

[Bug 1904486] Re: resource leak in /net/tap.c

2020-11-19 Thread Alex Chen
Hi yuanjungong, If you don't have time to submit a patch, can I submit a patch to fix it? -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1904486 Title: resource leak in /net/tap.c Status in QEMU:

Re: [PATCH] display/vmware_vga: Fix bad printf format specifiers

2020-11-19 Thread Alex Chen
Hi Philippe, On 2020/11/19 14:16, Philippe Mathieu-Daudé wrote: > Hi Alex, > > On 11/19/20 4:01 AM, Alex Chen wrote: >> We should use printf format specifier "%u" instead of "%d" for >> argument of type "unsigned int". >> >> Repor

[PATCH] display/vmware_vga: Fix bad printf format specifiers

2020-11-18 Thread Alex Chen
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int". Reported-by: Euler Robot Signed-off-by: Alex Chen --- hw/display/vmware_vga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/vmware_v

[PATCH] hw/display/qxl: Fix bad printf format specifiers

2020-11-18 Thread Alex Chen
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int". Reported-by: Euler Robot Signed-off-by: Alex Chen --- hw/display/qxl-logger.c | 4 ++-- hw/display/qxl.c| 2 +- 2 files changed, 3 insertions(+), 3 deletions(-

[PATCH] hw/usb: Fix bad printf format specifiers

2020-11-18 Thread Alex Chen
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int". Reported-by: Euler Robot Signed-off-by: Alex Chen --- hw/usb/ccid-card-passthru.c | 2 +- hw/usb/core.c | 4 ++-- hw/usb/dev-smartcard-reader.c |

Re: [PATCH] hw/arm: Fix bad print format specifiers

2020-11-18 Thread Alex Chen
Kindly ping. On 2020/11/2 17:55, AlexChen wrote: > We should use printf format specifier "%u" instead of "%i" for > argument of type "unsigned int". > > Reported-by: Euler Robot > Signed-off-by: Alex Chen > --- > hw/arm/pxa2xx.c | 2 +- >

[Bug 1904486] Re: resource leak in /net/tap.c

2020-11-17 Thread Alex Chen
hi yuanjungong, You can send a patch to qemu-devel mailing list(https://wiki.qemu.org/MailingLists) to fix this memleak according to https://wiki.qemu.org/Contribute/SubmitAPatch. Thanks. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to

Re: [PATCH 2/2] plugins: Fix two resource leaks in connect_socket()

2020-11-16 Thread Alex Chen
On 2020/11/17 0:50, Thomas Huth wrote: > On 28/10/2020 14.45, AlexChen wrote: >> Either accept() fails or exits normally, we need to close the fd. >> >> Reported-by: Euler Robot >> Signed-off-by: AlexChen >> --- >> contrib/plugins/lockstep.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff

Re: [PATCH v2] json: Fix a memleak in parse_pair()

2020-11-16 Thread Alex Chen
On 2020/11/16 19:43, Philippe Mathieu-Daudé wrote: > On 11/16/20 7:42 AM, Markus Armbruster wrote: >> "Chenqun (kuhn)" writes: >> -Original Message- From: Chenzhendong (alex) Sent: Friday, November 13, 2020 10:55 PM To: arm...@redhat.com Cc: Chenzhendong (alex) ;

Re: [PATCH] contrib/libvhost-user: Fix bad printf format specifiers

2020-11-16 Thread Alex Chen
On 2020/11/16 17:52, Michael S. Tsirkin wrote: > It's in the latest pull weren't you Cc'd? > This is my fault, I see this patch in the latest pull. thank you!!! Thanks, Alex > On Mon, Nov 16, 2020 at 10:14:12AM +0800, Alex Chen wrote: >> Kindly ping... >> >> On 2020

Re: [PATCH] usb/hcd-xhci: Fix an index-out-of-bounds in xhci_runtime_write and xhci_runtime_read

2020-11-15 Thread Alex Chen
/qemu/softmmu/memory.c:0:13 > #4 0x55bd2ed7fa46 in flatview_write_continue > /src/qemu/softmmu/physmem.c:2767:23 > #5 0x55bd2ed7cac0 in flatview_write /src/qemu/softmmu/physmem.c:2807:14 > > This patch fixes this bug. > > Buglink: https://bugs.launchpad.net/qemu/+bug/1902112 > Report

Re: [PATCH] contrib/libvhost-user: Fix bad printf format specifiers

2020-11-15 Thread Alex Chen
Kindly ping... On 2020/11/4 18:23, AlexChen wrote: > We should use printf format specifier "%u" instead of "%d" for > argument of type "unsigned int". > > Reported-by: Euler Robot > Signed-off-by: Alex Chen > --- > contrib/libvhost-user/libv

[PATCH v2] json: Fix a memleak in parse_pair()

2020-11-13 Thread Alex Chen
-thread-posix.c:519 Fixes: 532fb5328473 ("qapi: Make more of qobject_to()") Reported-by: Euler Robot Signed-off-by: Alex Chen Signed-off-by: Chen Qun Signed-off-by: Markus Armbruster --- qobject/json-parser.c | 12 ++-- tests/check-qjson.c | 9 + 2 files changed, 15

Re: [PATCH] json: Fix a memleak in parse_pair()

2020-11-13 Thread Alex Chen
On 2020/11/12 14:37, Markus Armbruster wrote: > Alex Chen writes: > >> In qobject_type(), NULL is returned when the 'QObject' returned from >> parse_value() is not of QString type, >> and this 'QObject' memory will leaked. >> So we need to first check wheth

[PATCH] json: Fix a memleak in parse_pair()

2020-11-11 Thread Alex Chen
: 532fb5328473 ("qapi: Make more of qobject_to()") Reported-by: Euler Robot Signed-off-by: Alex Chen Signed-off-by: Chen Qun --- qobject/json-parser.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/qobject/json-parser.c b/qobject/json-parser.c index

[PATCH] qemu-keymap.c: Fix bad printf format specifiers

2020-11-10 Thread Alex Chen
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int". Reported-by: Euler Robot Signed-off-by: Alex Chen --- qemu-keymap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu-keymap.c b/qemu-keymap.

[PATCH] exynos: Fix bad printf format specifiers

2020-11-10 Thread Alex Chen
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int". Reported-by: Euler Robot Signed-off-by: Alex Chen --- hw/timer/exynos4210_mct.c | 4 ++-- hw/timer/exynos4210_pwm.c | 8 2 files changed, 6 insertions(+), 6

Re: [PATCH] net/l2tpv3: Remove redundant check in net_init_l2tpv3()

2020-11-10 Thread Alex Chen
Kindly ping. On 2020/10/30 10:46, AlexChen wrote: > The result has been checked to be NULL before, it cannot be NULL here, > so the check is redundant. Remove it. > > Reported-by: Euler Robot > Signed-off-by: AlexChen > --- > net/l2tpv3.c | 9 +++-- > 1 file changed, 3 insertions(+), 6

Re: [PATCH] qtest: Fix bad printf format specifiers

2020-11-09 Thread Alex Chen
AlexChen wrote: >>>>>> On 2020/11/4 18:44, Thomas Huth wrote: >>>>>>> On 04/11/2020 11.23, AlexChen wrote: >>>>>>>> We should use printf format specifier "%u" instead of "%d" for >>>>>>>> ar

[PATCH v3 2/2] plugins: Fix two resource leaks in setup_socket()

2020-11-09 Thread Alex Chen
Either accept() fails or exits normally, we need to close the fd. Reported-by: Euler Robot Signed-off-by: Alex Chen --- contrib/plugins/lockstep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c index 319bd44b83..5aad50869d 100644

[PATCH v3 1/2] plugins: Fix resource leak in connect_socket()

2020-11-09 Thread Alex Chen
Close the fd when the connect() fails. Reported-by: Euler Robot Signed-off-by: Alex Chen --- contrib/plugins/lockstep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c index a696673dff..319bd44b83 100644 --- a/contrib/plugins

[PATCH v3 0/2] plugins: Fix some resource leaks

2020-11-09 Thread Alex Chen
There are 3 resource leaks in contrib/plugins/lockstep.c, fix it. v2->v3: - change the "From" line to "Alex Chen" v1->v2: - add the cover letter - modify the subject of the patch[2/2] Alex Chen (2): plugins: Fix resource leak in connect_socket() plugi