[PATCH v2] qed: Add cleanup in qed_slowpath_start()

2019-08-20 Thread Wenwen Wang
If qed_mcp_send_drv_version() fails, no cleanup is executed, leading to memory leaks. To fix this issue, introduce the label 'err4' to perform the cleanup work before returning the error. Signed-off-by: Wenwen Wang --- drivers/net/ethernet/qlogic/qed/qed_main.c | 4 +++- 1 file changed, 3

Re: [EXT] [PATCH] qed: Add cleanup in qed_slowpath_start()

2019-08-20 Thread Wenwen Wang
On Tue, Aug 13, 2019 at 6:46 AM Sudarsana Reddy Kalluru wrote: > > > -Original Message- > > From: Wenwen Wang > > Sent: Tuesday, August 13, 2019 3:35 PM > > To: Wenwen Wang > > Cc: Ariel Elior ; GR-everest-linux-l2 > l...@marvell.com>; David

[PATCH v2] net: pch_gbe: Fix memory leaks

2019-08-20 Thread Wenwen Wang
In pch_gbe_set_ringparam(), if netif_running() returns false, 'tx_old' and 'rx_old' are not deallocated, leading to memory leaks. To fix this issue, move the free statements to the outside of the if() statement. Signed-off-by: Wenwen Wang --- drivers/net/ethernet/oki-semi/pch_gbe

Re: [PATCH] net: pch_gbe: Fix memory leaks

2019-08-20 Thread Wenwen Wang
On Thu, Aug 15, 2019 at 4:51 PM David Miller wrote: > > From: Wenwen Wang > Date: Thu, 15 Aug 2019 16:46:05 -0400 > > > On Thu, Aug 15, 2019 at 4:42 PM David Miller wrote: > >> > >> From: Wenwen Wang > >> Date: Thu, 15 Aug 2019 16:03:39 -0400 >

[PATCH v2] ACPI / PCI: fix acpi_pci_irq_enable() memory leak

2019-08-20 Thread Wenwen Wang
("x86/ACPI/PCI: Recognize that Interrupt Line 255 means "not connected"") Signed-off-by: Wenwen Wang --- drivers/acpi/pci_irq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index d2549ae..dea8a60 10064

Re: [PATCH] ACPI / PCI: fix a memory leak bug

2019-08-20 Thread Wenwen Wang
On Mon, Aug 19, 2019 at 5:23 PM Bjorn Helgaas wrote: > > The subject line should give a clue about where the leak is, e.g., > > ACPI / PCI: fix acpi_pci_irq_enable() memory leak > > On Thu, Aug 15, 2019 at 11:33:22PM -0500, Wenwen Wang wrote: > > In acpi_pci_irq_enable

[PATCH v2] NFSv4: Fix a memory leak bug

2019-08-20 Thread Wenwen Wang
In nfs4_try_migration(), if nfs4_begin_drain_session() fails, the previously allocated 'page' and 'locations' are not deallocated, leading to memory leaks. To fix this issue, go to the 'out' label to free 'page' and 'locations' before returning the error. Signed-off-by: Wenwen Wang --- fs/nfs

Re: [PATCH] NFSv4: Fix a memory leak bug

2019-08-20 Thread Wenwen Wang
On Tue, Aug 20, 2019 at 9:41 AM Schumaker, Anna wrote: > > Hi Wenwen, > > On Tue, 2019-08-20 at 02:54 -0500, Wenwen Wang wrote: > > In nfs4_try_migration(), if nfs4_begin_drain_session() fails, the > > previously allocated 'page' and 'locations' are not deallocated, &

[PATCH] NFSv4: Fix a memory leak bug

2019-08-20 Thread Wenwen Wang
In nfs4_try_migration(), if nfs4_begin_drain_session() fails, the previously allocated 'page' and 'locations' are not deallocated, leading to memory leaks. To fix this issue, free 'page' and 'locations' before returning the error. Signed-off-by: Wenwen Wang --- fs/nfs/nfs4state.c | 6 +- 1

[PATCH] omfs: Fix a memory leak bug

2019-08-20 Thread Wenwen Wang
In omfs_get_imap(), 'sbi->s_imap' is allocated through kcalloc(). However, it is not deallocated in the following execution if 'block' is not less than 'sbi->s_num_blocks', leading to a memory leak bug. To fix this issue, go to the 'nomem_free' label to free 'sbi->s_imap'. Signed-off-b

[PATCH] ecryptfs: fix a memory leak bug

2019-08-19 Thread Wenwen Wang
In ecryptfs_init_messaging(), if the allocation for 'ecryptfs_msg_ctx_arr' fails, the previously allocated 'ecryptfs_daemon_hash' is not deallocated, leading to a memory leak bug. To fix this issue, free 'ecryptfs_daemon_hash' before returning the error. Signed-off-by: Wenwen Wang --- fs

[PATCH] ecryptfs: fix a memory leak bug

2019-08-19 Thread Wenwen Wang
In parse_tag_1_packet(), if tag 1 packet contains a key larger than ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES, no cleanup is executed, leading to a memory leak on the allocated 'auth_tok_list_item'. To fix this issue, go to the label 'out_free' to perform the cleanup work. Signed-off-by: Wenwen Wang

[PATCH] ubifs: fix a memory leak bug

2019-08-19 Thread Wenwen Wang
In ubifs_mount(), 'c' is allocated through kzalloc() in alloc_ubifs_info(). However, it is not deallocated in the following execution if ubifs_fill_super() fails, leading to a memory leak bug. To fix this issue, free 'c' before going to the 'out_deact' label. Signed-off-by: Wenwen Wang --- fs

[PATCH] ubifs: fix a memory leak bug

2019-08-19 Thread Wenwen Wang
In __ubifs_node_verify_hmac(), 'hmac' is allocated through kmalloc(). However, it is not deallocated in the following execution if ubifs_node_calc_hmac() fails, leading to a memory leak bug. To fix this issue, free 'hmac' before returning the error. Signed-off-by: Wenwen Wang --- fs/ubifs

[PATCH] ubifs: fix a memory leak bug

2019-08-19 Thread Wenwen Wang
In read_znode(), the indexing node 'idx' is allocated by kmalloc(). However, it is not deallocated in the following execution if ubifs_node_check_hash() fails, leading to a memory leak bug. To fix this issue, free 'idx' before returning the error. Signed-off-by: Wenwen Wang --- fs/ubifs

[PATCH] locks: fix a memory leak bug

2019-08-19 Thread Wenwen Wang
In __break_lease(), the file lock 'new_fl' is allocated in lease_alloc(). However, it is not deallocated in the following execution if smp_load_acquire() fails, leading to a memory leak bug. To fix this issue, free 'new_fl' before returning the error. Signed-off-by: Wenwen Wang --- fs/locks.c

[PATCH] jffs2: fix a memory leak bug

2019-08-19 Thread Wenwen Wang
-off-by: Wenwen Wang --- fs/jffs2/scan.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 90431dd..5f7e284 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c @@ -527,8 +527,11 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c

[PATCH] led: triggers: Fix a memory leak bug

2019-08-19 Thread Wenwen Wang
In led_trigger_set(), 'event' is allocated in kasprintf(). However, it is not deallocated in the following execution if the label 'err_activate' or 'err_add_groups' is entered, leading to memory leaks. To fix this issue, free 'event' before returning the error. Signed-off-by: Wenwen Wang

[PATCH v2] mtd: spi-nor: fix a memory leak bug

2019-08-19 Thread Wenwen Wang
-byte Address Instruction Table") Signed-off-by: Wenwen Wang --- drivers/mtd/spi-nor/spi-nor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 03cc788..a41a466 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++

Re: [PATCH] mtd: spi-nor: fix a memory leak bug

2019-08-19 Thread Wenwen Wang
On Mon, Aug 19, 2019 at 2:03 AM wrote: > > > > On 08/18/2019 08:39 PM, Wenwen Wang wrote: > > In spi_nor_parse_4bait(), 'dwords' is allocated through kmalloc(). However, > > it is not deallocated in the following execution if spi_nor_read_sfdp() > > fails, le

[PATCH v2] mtd: rawnand: Fix a memory leak bug

2019-08-18 Thread Wenwen Wang
In nand_scan_bbt(), a temporary buffer 'buf' is allocated through vmalloc(). However, if check_create() fails, 'buf' is not deallocated, leading to a memory leak bug. To fix this issue, free 'buf' before returning the error. Signed-off-by: Wenwen Wang --- drivers/mtd/nand/raw/nand_bbt.c | 10

[PATCH] IB/mlx4: Fix memory leaks

2019-08-18 Thread Wenwen Wang
In mlx4_ib_alloc_pv_bufs(), 'tun_qp->tx_ring' is allocated through kcalloc(). However, it is not always deallocated in the following execution if an error occurs, leading to memory leaks. To fix this issue, free 'tun_qp->tx_ring' whenever an error occurs. Signed-off-by: Wenwen Wang --- d

[PATCH] infiniband: hfi1: fix a memory leak bug

2019-08-18 Thread Wenwen Wang
In fault_opcodes_read(), 'data' is not deallocated if debugfs_file_get() fails, leading to a memory leak. To fix this bug, introduce the 'free_data' label to free 'data' before returning the error. Signed-off-by: Wenwen Wang --- drivers/infiniband/hw/hfi1/fault.c | 3 ++- 1 file changed, 2

[PATCH] infiniband: hfi1: fix memory leaks

2019-08-18 Thread Wenwen Wang
In fault_opcodes_write(), 'data' is allocated through kcalloc(). However, it is not deallocated in the following execution if an error occurs, leading to memory leaks. To fix this issue, introduce the 'free_data' label to free 'data' before returning the error. Signed-off-by: Wenwen Wang

[PATCH] mtd: spi-nor: fix a memory leak bug

2019-08-18 Thread Wenwen Wang
In spi_nor_parse_4bait(), 'dwords' is allocated through kmalloc(). However, it is not deallocated in the following execution if spi_nor_read_sfdp() fails, leading to a memory leak. To fix this issue, free 'dwords' before returning the error. Signed-off-by: Wenwen Wang --- drivers/mtd/spi-nor

[PATCH] mtd: sm_ftl: fix memory leaks

2019-08-18 Thread Wenwen Wang
e them before returning -EIO. Signed-off-by: Wenwen Wang --- drivers/mtd/sm_ftl.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c index dfc47a4..4744bf9 100644 --- a/drivers/mtd/sm_ftl.c +++ b/drivers/mtd/sm_ftl.c @@ -774,8 +774,11 @@

[PATCH] mtd: onenand_base: Fix a memory leak bug

2019-08-18 Thread Wenwen Wang
erify_buf' before returning the error. Signed-off-by: Wenwen Wang --- drivers/mtd/nand/onenand/onenand_base.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/nand/onenand/onenand_base.c b/drivers/mtd/nand/onenand/onenand_base.c index e082d63..77bd32a 100644 --- a/drivers/mtd/nan

[PATCH] mtd: rawnand: Fix a memory leak bug

2019-08-18 Thread Wenwen Wang
In nand_scan_bbt(), a temporary buffer 'buf' is allocated through vmalloc(). However, if check_create() fails, 'buf' is not deallocated, leading to a memory leak bug. To fix this issue, free 'buf' before returning the error. Signed-off-by: Wenwen Wang --- drivers/mtd/nand/raw/nand_bbt.c | 8

[PATCH] media: ti-vpe: Add cleanup in vpdma_list_cleanup()

2019-08-18 Thread Wenwen Wang
If an error occurs in this function, no cleanup is executed, leading to memory/resource leaks. To fix this issue, introduce two labels to perform the cleanup work. Signed-off-by: Wenwen Wang --- drivers/media/platform/ti-vpe/vpdma.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions

[PATCH] media: fdp1: Fix a memory leak bug

2019-08-17 Thread Wenwen Wang
In fdp1_open(), 'ctx' is allocated through kzalloc(). However, it is not deallocated if v4l2_ctrl_new_std() fails, leading to a memory leak bug. To fix this issue, free 'ctx' before going to the 'done' label. Signed-off-by: Wenwen Wang --- drivers/media/platform/rcar_fdp1.c | 1 + 1 file

[PATCH v2] media: saa7146: add cleanup in hexium_attach()

2019-08-17 Thread Wenwen Wang
If saa7146_register_device() fails, no cleanup is executed, leading to memory/resource leaks. To fix this issue, perform necessary cleanup work before returning the error. Signed-off-by: Wenwen Wang --- drivers/media/pci/saa7146/hexium_gemini.c | 3 +++ 1 file changed, 3 insertions(+) diff

[PATCH] media: saa7146: add cleanup in hexium_attach()

2019-08-17 Thread Wenwen Wang
If saa7146_register_device(), no cleanup is executed, leading to memory/resource leaks. To fix this issue, perform necessary cleanup work before returning the error. Signed-off-by: Wenwen Wang --- drivers/media/pci/saa7146/hexium_gemini.c | 3 +++ 1 file changed, 3 insertions(+) diff --git

[PATCH] media: dvb-core: fix a memory leak bug

2019-08-17 Thread Wenwen Wang
tity' before returning -ENOMEM. Signed-off-by: Wenwen Wang --- drivers/media/dvb-core/dvbdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c index a3393cd..7557fbf 100644 --- a/drivers/media/dvb-core/dvbdev.c +

[PATCH] media: dvb-frontends: fix a memory leak bug

2019-08-17 Thread Wenwen Wang
In cx24117_load_firmware(), 'buf' is allocated through kmalloc() to hold the firmware. However, if i2c_transfer() fails, it is not deallocated, leading to a memory leak bug. Signed-off-by: Wenwen Wang --- drivers/media/dvb-frontends/cx24117.c | 4 +++- 1 file changed, 3 insertions(+), 1

[PATCH] media: dvb-frontends: fix memory leaks

2019-08-17 Thread Wenwen Wang
In dib7000pc_detection(), 'tx' and 'rx' are allocated through kzalloc() respectively. However, if DiB7000PC is detected, they are not deallocated, leading to memory leaks. To fix this issue, create a label to free 'tx' and 'rx' before returning from the function. Signed-off-by: Wenwen Wang

[PATCH] media: usb: cx231xx-417: fix a memory leak bug

2019-08-17 Thread Wenwen Wang
In cx231xx_load_firmware(), 'p_buffer' is allocated through vmalloc() to hold the firmware. However, after the usage, it is not deallocated, leading to a memory leak bug. Signed-off-by: Wenwen Wang --- drivers/media/usb/cx231xx/cx231xx-417.c | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH] media: cpia2_usb: fix memory leaks

2019-08-16 Thread Wenwen Wang
In submit_urbs(), 'cam->sbuf[i].data' is allocated through kmalloc_array(). However, it is not deallocated if the following allocation for urbs fails. To fix this issue, free 'cam->sbuf[i].data' if usb_alloc_urb() fails. Signed-off-by: Wenwen Wang --- drivers/media/usb/cpia2/cpia2_usb

[PATCH] libata: Fix a memory leak bug

2019-08-16 Thread Wenwen Wang
In ata_init(), 'ata_force_tbl' is allocated through kcalloc() in ata_parse_force_param(). However, it is not deallocated if ata_attach_transport() fails, leading to a memory leak bug. To fix this issue, free 'ata_force_tbl' before go to the 'err_out' label. Signed-off-by: Wenwen Wang

[PATCH] dmaengine: ti: omap-dma: Add cleanup in omap_dma_probe()

2019-08-16 Thread Wenwen Wang
If devm_request_irq() fails to disable all interrupts, no cleanup is performed before retuning the error. To fix this issue, invoke omap_dma_free() to do the cleanup. Signed-off-by: Wenwen Wang --- drivers/dma/ti/omap-dma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git

[PATCH v2] dmaengine: ti: dma-crossbar: Fix a memory leak bug

2019-08-16 Thread Wenwen Wang
the error. Signed-off-by: Wenwen Wang --- drivers/dma/ti/dma-crossbar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma/ti/dma-crossbar.c b/drivers/dma/ti/dma-crossbar.c index ad2f0a4..f255056 100644 --- a/drivers/dma/ti/dma-crossbar.c +++ b/drivers/dma/ti/dma

Re: [PATCH] dmaengine: ti: Fix a memory leak bug

2019-08-16 Thread Wenwen Wang
On Fri, Aug 16, 2019 at 2:42 AM Peter Ujfalusi wrote: > > > > On 16/08/2019 9.23, Wenwen Wang wrote: > > In ti_dra7_xbar_probe(), 'rsv_events' is allocated through kcalloc(). Then > > of_property_read_u32_array() is invoked to search for the property. > >

[PATCH] dmaengine: ti: Fix a memory leak bug

2019-08-16 Thread Wenwen Wang
the error. Signed-off-by: Wenwen Wang --- drivers/dma/ti/dma-crossbar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma/ti/dma-crossbar.c b/drivers/dma/ti/dma-crossbar.c index ad2f0a4..f255056 100644 --- a/drivers/dma/ti/dma-crossbar.c +++ b/drivers/dma/ti/dma

[PATCH] ACPI: custom_method: fix memory leaks

2019-08-15 Thread Wenwen Wang
In cm_write(), 'buf' is allocated through kzalloc(). In the following execution, if an error occurs, 'buf' is not deallocated, leading to memory leaks. To fix this issue, free 'buf' before returning the error. Signed-off-by: Wenwen Wang --- drivers/acpi/custom_method.c | 5 - 1 file changed

[PATCH] ACPI / PCI: fix a memory leak bug

2019-08-15 Thread Wenwen Wang
In acpi_pci_irq_enable(), 'entry' is allocated by invoking acpi_pci_irq_lookup(). However, it is not deallocated if acpi_pci_irq_valid() returns false, leading to a memory leak. To fix this issue, free 'entry' before returning 0. Signed-off-by: Wenwen Wang --- drivers/acpi/pci_irq.c | 4 +++- 1

[PATCH] airo: fix memory leaks

2019-08-15 Thread Wenwen Wang
urning the error. Signed-off-by: Wenwen Wang --- drivers/net/wireless/cisco/airo.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c index 9342ffb..f43c065 100644 --- a/drivers/net/wireless/cisco/

Re: [PATCH] net: pch_gbe: Fix memory leaks

2019-08-15 Thread Wenwen Wang
On Thu, Aug 15, 2019 at 4:42 PM David Miller wrote: > > From: Wenwen Wang > Date: Thu, 15 Aug 2019 16:03:39 -0400 > > > On Thu, Aug 15, 2019 at 3:34 PM David Miller wrote: > >> > >> From: Wenwen Wang > >> Date: Tue, 13 Aug 2019 20:33:

[PATCH v2] wimax/i2400m: fix a memory leak bug

2019-08-15 Thread Wenwen Wang
'options_orig' before returning the error. Signed-off-by: Wenwen Wang --- drivers/net/wimax/i2400m/fw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c index e9fc168..489cba9 100644 --- a/drivers/net/wimax/i2400m/fw.c

Re: [PATCH] wimax/i2400m: fix a memory leak bug

2019-08-15 Thread Wenwen Wang
On Thu, Aug 15, 2019 at 2:45 PM Liam R. Howlett wrote: > > * Wenwen Wang [190815 14:05]: > > In i2400m_barker_db_init(), 'options_orig' is allocated through kstrdup() > > to hold the original command line options. Then, the options are parsed. > > However, if an error o

Re: [PATCH] net: pch_gbe: Fix memory leaks

2019-08-15 Thread Wenwen Wang
On Thu, Aug 15, 2019 at 3:34 PM David Miller wrote: > > From: Wenwen Wang > Date: Tue, 13 Aug 2019 20:33:45 -0500 > > > In pch_gbe_set_ringparam(), if netif_running() returns false, 'tx_old' and > > 'rx_old' are not deallocated, leading to memory leaks. To fix this

[PATCH] wimax/i2400m: fix a memory leak bug

2019-08-15 Thread Wenwen Wang
'options_orig' before returning the error. Signed-off-by: Wenwen Wang --- drivers/net/wimax/i2400m/fw.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c index e9fc168..6b36f6d 100644 --- a/drivers/net/wimax/i2400m/fw.c

[PATCH] hv_netvsc: Fix a memory leak bug

2019-08-14 Thread Wenwen Wang
. Signed-off-by: Wenwen Wang --- drivers/net/hyperv/rndis_filter.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 317dbe9..ed35085 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c

[PATCH] cx82310_eth: fix a memory leak bug

2019-08-14 Thread Wenwen Wang
y leak bug. To fix this issue, free 'dev->partial_data' before returning the error. Signed-off-by: Wenwen Wang --- drivers/net/usb/cx82310_eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/cx82310_eth.c b/drivers/net/usb/cx82310_eth.c index 5519248

[PATCH] net: usbnet: fix a memory leak bug

2019-08-14 Thread Wenwen Wang
y leak bug. Signed-off-by: Wenwen Wang --- drivers/net/usb/usbnet.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 72514c4..f17fafa 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1433,6 +1433,7 @@ netde

[PATCH] net: myri10ge: fix memory leaks

2019-08-14 Thread Wenwen Wang
the target label of the goto statement to 'abort_with_slices'. Signed-off-by: Wenwen Wang --- drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge

[PATCH] liquidio: add cleanup in octeon_setup_iq()

2019-08-13 Thread Wenwen Wang
If oct->fn_list.enable_io_queues() fails, no cleanup is executed, leading to memory/resource leaks. To fix this issue, invoke octeon_delete_instr_queue() before returning from the function. Signed-off-by: Wenwen Wang --- drivers/net/ethernet/cavium/liquidio/request_manager.c | 4 +++- 1 f

[PATCH] net: pch_gbe: Fix memory leaks

2019-08-13 Thread Wenwen Wang
In pch_gbe_set_ringparam(), if netif_running() returns false, 'tx_old' and 'rx_old' are not deallocated, leading to memory leaks. To fix this issue, move the free statements after the if branch. Signed-off-by: Wenwen Wang --- drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c | 4 ++-- 1

[PATCH] qed: Add cleanup in qed_slowpath_start()

2019-08-13 Thread Wenwen Wang
If qed_mcp_send_drv_version() fails, no cleanup is executed, leading to memory leaks. To fix this issue, redirect the execution to the label 'err3' before returning the error. Signed-off-by: Wenwen Wang --- drivers/net/ethernet/qlogic/qed/qed_main.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH] cxgb4: fix a memory leak bug

2019-08-13 Thread Wenwen Wang
In blocked_fl_write(), 't' is not deallocated if bitmap_parse_user() fails, leading to a memory leak bug. To fix this issue, free t before returning the error. Signed-off-by: Wenwen Wang --- drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion

[PATCH] net/mlx5: Fix a memory leak bug

2019-08-13 Thread Wenwen Wang
on this program path, leading to a memory leak bug. To fix the above issue, free 'ent' before returning the error. Signed-off-by: Wenwen Wang --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c

[PATCH v2] net/mlx4_en: fix a memory leak bug

2019-08-12 Thread Wenwen Wang
issue, add the 'qp_alloc_err' label to free 'rss_map->indir_qp'. Fixes: 4931c6ef04b4 ("net/mlx4_en: Optimized single ring steering") Signed-off-by: Wenwen Wang --- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/d

Re: [PATCH] net/mlx4_en: fix a memory leak bug

2019-08-12 Thread Wenwen Wang
On Mon, Aug 12, 2019 at 5:05 AM Tariq Toukan wrote: > > Hi Wenwen, > > Thanks for your patch. > > On 8/12/2019 9:36 AM, Wenwen Wang wrote: > > In mlx4_en_config_rss_steer(), 'rss_map->indir_qp' is allocated through > > kzalloc(). After that, mlx4_qp_al

[PATCH] net/mlx4_en: fix a memory leak bug

2019-08-12 Thread Wenwen Wang
issue, add the 'mlx4_err' label to free 'rss_map->indir_qp'. Signed-off-by: Wenwen Wang --- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_r

[PATCH] e1000: fix memory leaks

2019-08-12 Thread Wenwen Wang
In e1000_set_ringparam(), 'tx_old' and 'rx_old' are not deallocated if e1000_up() fails, leading to memory leaks. Refactor the code to fix this issue. Signed-off-by: Wenwen Wang --- drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions

[PATCH] net: ixgbe: fix memory leaks

2019-08-11 Thread Wenwen Wang
', and 'mask' are not deallocated on this execution path, leading to memory leaks. Signed-off-by: Wenwen Wang --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe

[PATCH] i3c: master: fix a memory leak bug

2019-08-11 Thread Wenwen Wang
buffer is not deallocated on this path, leading to a memory leak. To fix the above issue, free the buffer before returning the error. Signed-off-by: Wenwen Wang --- drivers/i3c/master.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c

[PATCH] ALSA: hda - Fix a memory leak bug

2019-08-09 Thread Wenwen Wang
In snd_hda_parse_generic_codec(), 'spec' is allocated through kzalloc(). Then, the pin widgets in 'codec' are parsed. However, if the parsing process fails, 'spec' is not deallocated, leading to a memory leak. To fix the above issue, free 'spec' before returning the error. Signed-off-by: Wenwen

[PATCH] ALSA: firewire: fix a memory leak bug

2019-08-07 Thread Wenwen Wang
y leak. To fix the above issue, free 'b->packets' before returning the error code. Signed-off-by: Wenwen Wang --- sound/firewire/packets-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/firewire/packets-buffer.c b/sound/firewire/packets-buffer.c index 0d35359

[PATCH] sound: fix a memory leak bug

2019-08-07 Thread Wenwen Wang
, -EBUSY is returned to indicate the error. However, 's' is not deallocated on this execution path, leading to a memory leak bug. To fix the above issue, free 's' before -EBUSY is returned. Signed-off-by: Wenwen Wang --- sound/sound_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff

[PATCH v3] ALSA: hiface: fix multiple memory leak bugs

2019-08-07 Thread Wenwen Wang
ut_urbs[i].buffer' are not deallocated, leading to memory leak bugs. Also, 'rt->out_urbs[i].buffer' is not deallocated if snd_pcm_new() fails. To fix the above issues, free 'rt' and 'rt->out_urbs[i].buffer'. Signed-off-by: Wenwen Wang --- sound/usb/hiface/pcm.c | 11 --- 1

Re: [PATCH v2] ALSA: pcm: fix multiple memory leak bugs

2019-08-07 Thread Wenwen Wang
On Wed, Aug 7, 2019 at 3:18 AM Takashi Iwai wrote: > > On Wed, 07 Aug 2019 09:09:59 +0200, > Wenwen Wang wrote: > > > > In hiface_pcm_init(), 'rt' is firstly allocated through kzalloc(). Later > > on, hiface_pcm_init_urb() is invoked to initialize 'rt->out_urbs[i

[PATCH v2] ALSA: pcm: fix multiple memory leak bugs

2019-08-07 Thread Wenwen Wang
ut_urbs[i].buffer' are not deallocated, leading to memory leak bugs. Also, 'rt->out_urbs[i].buffer' is not deallocated if snd_pcm_new() fails. To fix the above issues, free 'rt' and 'rt->out_urbs[i].buffer'. Signed-off-by: Wenwen Wang --- sound/usb/hiface/pcm.c | 8 +++- 1 file change

Re: [PATCH] ALSA: pcm: fix a memory leak bug

2019-08-07 Thread Wenwen Wang
On Wed, Aug 7, 2019 at 2:33 AM Takashi Iwai wrote: > > On Wed, 07 Aug 2019 08:15:17 +0200, > Wenwen Wang wrote: > > > > In hiface_pcm_init(), 'rt' is firstly allocated through kzalloc(). Later > > on, hiface_pcm_init_urb() is invoked to initialize 'rt

[PATCH] ALSA: pcm: fix a memory leak bug

2019-08-07 Thread Wenwen Wang
ror. Signed-off-by: Wenwen Wang --- sound/usb/hiface/pcm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/usb/hiface/pcm.c b/sound/usb/hiface/pcm.c index 14fc1e1..5dbcd0d 100644 --- a/sound/usb/hiface/pcm.c +++ b/sound/usb/hiface/pcm.c @@ -599,8 +599,10 @@

Re: [PATCH] ALSA: usb-midi: fix a memory leak bug

2019-08-06 Thread Wenwen Wang
On Wed, Aug 7, 2019 at 1:31 AM Takashi Iwai wrote: > > On Wed, 07 Aug 2019 05:22:09 +0200, > Wenwen Wang wrote: > > > > In __snd_usbmidi_create(), a MIDI streaming interface structure is > > allocated through kzalloc() and the pointer is saved to 'umidi'. Later on,

[PATCH] ALSA: usb-midi: fix a memory leak bug

2019-08-06 Thread Wenwen Wang
quirk type. However, if the creation fails, the allocated 'umidi' is not deallocated, leading to a memory leak bug. To fix the above issue, free 'umidi' before returning the error. Signed-off-by: Wenwen Wang --- sound/usb/midi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH] ALSA: usb-audio: fix a memory leak bug

2019-08-06 Thread Wenwen Wang
map' before returning NULL. Signed-off-by: Wenwen Wang --- sound/usb/stream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/usb/stream.c b/sound/usb/stream.c index 7ee9d17..e852c7f 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c @@ -1043,6 +1043,7 @@ snd_usb_get_audioformat_u

[PATCH] ALSA: usb-audio: fix a memory leak bug

2019-08-06 Thread Wenwen Wang
, the allocated structure is not freed, leading to a memory leak. To fix the above issue, free 'elem' before returning the error. Signed-off-by: Wenwen Wang --- sound/usb/mixer_scarlett.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/usb/mixer_scarlett.c b/sound/usb

[PATCH] ASoC: dapm: fix a memory leak bug

2019-07-22 Thread Wenwen Wang
From: Wenwen Wang In snd_soc_dapm_new_control_unlocked(), a kernel buffer is allocated in dapm_cnew_widget() to hold the new dapm widget. Then, different actions are taken according to the id of the widget, i.e., 'w->id'. If any failure occurs during this proc

[PATCH] test_firmware: fix a memory leak bug

2019-07-14 Thread Wenwen Wang
From: Wenwen Wang In test_firmware_init(), the buffer pointed to by the global pointer 'test_fw_config' is allocated through kzalloc(). Then, the buffer is initialized in __test_firmware_config_init(). In the case that the initialization fails, the following execution in test_firmware_init

[PATCH v2] ALSA: usx2y: fix a double free bug

2019-04-29 Thread Wenwen Wang
frees the created urb. However, the urb is actually freed at card->private_free callback, i.e., snd_usX2Y_card_private_free(). So the free operation here leads to a double free bug. To fix the above issue, simply remove usb_free_urb(). Signed-off-by: Wenwen Wang --- sound/usb/usx2y/usbusx2y.c | 4 +--

Re: [PATCH] ALSA: usx2y: fix a memory leak bug

2019-04-29 Thread Wenwen Wang
On Mon, Apr 29, 2019 at 1:42 AM Takashi Iwai wrote: > > On Mon, 29 Apr 2019 07:50:11 +0200, > Wenwen Wang wrote: > > > > On Mon, Apr 29, 2019 at 12:36 AM Takashi Iwai wrote: > > > > > > On Sun, 28 Apr 2019 09:18:40 +0200, > > > Takashi Iwai wro

Re: [PATCH] ALSA: usx2y: fix a memory leak bug

2019-04-28 Thread Wenwen Wang
On Mon, Apr 29, 2019 at 12:36 AM Takashi Iwai wrote: > > On Sun, 28 Apr 2019 09:18:40 +0200, > Takashi Iwai wrote: > > > > On Sun, 28 Apr 2019 08:42:32 +0200, > > Wenwen Wang wrote: > > > > > > In usX2Y_In04_init(), a new urb is firstly created thro

[PATCH] ALSA: usx2y: fix a memory leak bug

2019-04-28 Thread Wenwen Wang
voking usb_urb_ep_type_check(). If the check fails, the error code EINVAL will be returned. In that case, however, the created urb and the allocated buffer are not freed, leading to memory leaks. To fix the above issue, free the urb and the buffer if the check fails. Signed-off-by: Wenwen Wang --- sound/usb

[PATCH] ALSA: usb-audio: Fix a memory leak bug

2019-04-27 Thread Wenwen Wang
string pointers 'namelist[]' in a loop. Signed-off-by: Wenwen Wang --- sound/usb/mixer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 73d7dff..53dccbf 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -2675,6 +2675,8 @@ static int

Re: [PATCH] tracing: Fix a memory leak bug

2019-04-19 Thread Wenwen Wang
On Fri, Apr 19, 2019 at 9:37 PM Steven Rostedt wrote: > > On Fri, 19 Apr 2019 21:22:59 -0500 > Wenwen Wang wrote: > > > In trace_pid_write(), the buffer for trace parser is allocated through > > kmalloc() in trace_parser_get_init(). Later on, after the buffer is us

[PATCH] tracing: Fix a memory leak bug

2019-04-19 Thread Wenwen Wang
., ENOMEM. In that case, the allocated buffer will not be freed, which is a memory leak bug. To fix this issue, free the allocated buffer when an error is encountered. Signed-off-by: Wenwen Wang --- kernel/trace/trace.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel

[PATCH v4] x86/PCI: fix a memory leak bug

2019-04-17 Thread Wenwen Wang
is used, this table is actually not used. However, in that case, the allocated table is not freed, which is a memory leak bug. To fix this issue, free the allocated table if it is not used. Signed-off-by: Wenwen Wang Acked-by: Thomas Gleixner --- arch/x86/pci/irq.c | 10 -- 1 file

Re: [PATCH v2] x86/PCI: fix a memory leak bug

2019-04-17 Thread Wenwen Wang
On Wed, Apr 17, 2019 at 12:58 AM Ingo Molnar wrote: > > > * Wenwen Wang wrote: > > > On Tue, Apr 16, 2019 at 3:33 PM Thomas Gleixner wrote: > > > > > > On Tue, 16 Apr 2019, Wenwen Wang wrote: > > > > > > > In pcibios_irq_init(), the PC

[PATCH v3] x86/PCI: fix a memory leak bug

2019-04-16 Thread Wenwen Wang
is used, this table is actually not used. However, in that case, the allocated table is not freed, which is a memory leak bug. To fix this issue, free the allocated table if it is not used. Signed-off-by: Wenwen Wang --- arch/x86/pci/irq.c | 10 -- 1 file changed, 8 insertions(+), 2

Re: [PATCH v2] x86/PCI: fix a memory leak bug

2019-04-16 Thread Wenwen Wang
On Tue, Apr 16, 2019 at 3:33 PM Thomas Gleixner wrote: > > On Tue, 16 Apr 2019, Wenwen Wang wrote: > > > In pcibios_irq_init(), the PCI IRQ routing table 'pirq_table' is firstly > > found through pirq_find_routing_table(). If the table is not found and > > 'CONFIG_PCI_

[PATCH v2] x86/PCI: fix a memory leak bug

2019-04-16 Thread Wenwen Wang
is used, this table is actually not used. However, in that case, the allocated table is not freed, which can lead to a memory leak bug. To fix this issue, this patch frees the allocated table if it is not used. Signed-off-by: Wenwen Wang --- arch/x86/pci/irq.c | 10 -- 1 file changed, 8

Re: [PATCH] x86/PCI: fix a memory leak bug

2019-04-16 Thread Wenwen Wang
On Tue, Apr 16, 2019 at 2:23 AM Ingo Molnar wrote: > > > * Wenwen Wang wrote: > > > In pcibios_irq_init(), the PCI IRQ routing table 'pirq_table' is firstly > > found through pirq_find_routing_table(). If the table is not found and > > 'CONFIG_PCI_BIOS' is define

[PATCH v2] udf: fix an uninitialized read bug and remove dead code

2019-04-15 Thread Wenwen Wang
in the following execution. To fix this issue, this patch drops the whole code in the ifdef 'UDF_RECOVERY' region, as it is dead code. Signed-off-by: Wenwen Wang --- fs/udf/namei.c | 15 --- 1 file changed, 15 deletions(-) diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 58cc241

Re: [PATCH] udf: fix an uninitialized read bug

2019-04-15 Thread Wenwen Wang
Thanks for your prompt reply, Jan! I will rework the patch. Best regards, Wenwen On Mon, Apr 15, 2019 at 11:05 AM Jan Kara wrote: > > On Mon 15-04-19 10:26:24, Wenwen Wang wrote: > > In udf_lookup(), the pointer 'fi' is a local variable initialized by the > > return value of

[PATCH] udf: fix an uninitialized read bug

2019-04-15 Thread Wenwen Wang
in the following execution. This patch simply initializes this local pointer to NULL. Signed-off-by: Wenwen Wang --- fs/udf/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 58cc241..9d499e1 100644 --- a/fs/udf/namei.c +++ b/fs/udf

[PATCH] x86/PCI: fix a memory leak bug

2019-04-15 Thread Wenwen Wang
is used, this table is actually not used. However, in that case, the allocated table is not freed, which can lead to a memory leak bug. To fix this issue, this patch frees the allocated table if it is not used. Signed-off-by: Wenwen Wang --- arch/x86/pci/irq.c | 10 -- 1 file changed, 8

[PATCH] gdrom: fix a memory leak bug

2018-12-26 Thread Wenwen Wang
, this buffer is not freed after it is used, which can cause a memory leak bug. This patch simply frees the buffer 'gd.cd_info' in exit_gdrom() to fix the above issue. Signed-off-by: Wenwen Wang --- drivers/cdrom/gdrom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/cdrom/gdrom.c b

[PATCH v2] misc: mic: fix a DMA pool free failure

2018-12-04 Thread Wenwen Wang
riable 'cb_arg' is allocated in _scif_prog_signal() to pass the arguments. 'cb_arg' will be freed after dma_pool_free() in scif_prog_signal_cb(). Signed-off-by: Wenwen Wang --- drivers/misc/mic/scif/scif_fence.c | 22 +- drivers/misc/mic/scif/scif_rma.h | 13 + 2

[PATCH v2] misc: mic: fix a DMA pool free failure

2018-12-04 Thread Wenwen Wang
riable 'cb_arg' is allocated in _scif_prog_signal() to pass the arguments. 'cb_arg' will be freed after dma_pool_free() in scif_prog_signal_cb(). Signed-off-by: Wenwen Wang --- drivers/misc/mic/scif/scif_fence.c | 22 +- drivers/misc/mic/scif/scif_rma.h | 13 + 2

Re: [PATCH] misc: mic: fix a DMA pool free failure

2018-12-04 Thread Wenwen Wang
On Sun, Nov 4, 2018 at 8:05 PM Sudeep Dutt wrote: > > On Thu, 2018-10-18 at 14:46 -0500, Wenwen Wang wrote: > > In _scif_prog_signal(), a DMA pool is allocated if the MIC Coprocessor is > > not X100, i.e., the boolean variable 'x100' is false. This DMA pool will be > >

  1   2   3   >