[PATCH v3] {net, IB}/mlx5: Use 'kvfree()' for memory allocated by 'kvzalloc()'

2018-05-16 Thread Christophe JAILLET
ntroduce access functions to query vport RoCE fields") Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- v1 -> v2: More places to update have been added to the patch v2 -> v3: Add Fixes tag 3 patches with one Fixes tag each should probably be better, but honest

Re: [PATCH] net/mlx5: Use 'kvfree()' for memory allocated by 'kvzalloc()'

2018-05-14 Thread Christophe Jaillet
Le 14/05/2018 à 20:56, David Miller a écrit : From: Christophe JAILLET <christophe.jail...@wanadoo.fr> Date: Sat, 12 May 2018 19:09:25 +0200 'out' is allocated with 'kvzalloc()'. 'kvfree()' must be used to free it. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr>

[PATCH v2] {net, IB}/mlx5: Use 'kvfree()' for memory allocated by 'kvzalloc()'

2018-05-13 Thread Christophe JAILLET
When 'kvzalloc()' is used to allocate memory, 'kvfree()' must be used to free it. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- v1 -> v2: More places to update have been added to the patch --- drivers/infiniband/hw/mlx5/cq.c| 2 +- dr

[PATCH] net/mlx5: Use 'kvfree()' for memory allocated by 'kvzalloc()'

2018-05-12 Thread Christophe JAILLET
'out' is allocated with 'kvzalloc()'. 'kvfree()' must be used to free it. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/mellanox/mlx5/core/vport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellano

Re: [PATCH] net: aquantia: Fix an error handling path in 'aq_pci_probe()'

2018-05-10 Thread Christophe JAILLET
Le 08/05/2018 à 09:19, Igor Russkikh a écrit : This was just submitted yesterday and is already accepted in netdev by David: http://patchwork.ozlabs.org/patch/909746/ Thanks! BR, Igor Patch timing is sometimes surprising! Not sure at all if it can be an issue, but I also noted that the

Re: [PATCH] net/mlx4_en: Fix an error handling path in 'mlx4_en_init_netdev()'

2018-05-10 Thread Christophe JAILLET
Le 10/05/2018 à 15:38, Yuval Shaia a écrit : On Thu, May 10, 2018 at 09:02:26AM +0200, Christophe JAILLET wrote: If an error occurs, 'mlx4_en_destroy_netdev()' is called. It then calls 'mlx4_en_free_resources()' which does the needed resources cleanup. So, doing some explicit kfree

[PATCH] mlxsw: core: Fix an error handling path in 'mlxsw_core_bus_device_register()'

2018-05-10 Thread Christophe JAILLET
Resources are not freed in the reverse order of the allocation. Labels are also mixed-up. Fix it and reorder code and labels in the error handling path of 'mlxsw_core_bus_device_register()' Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- Please review carefully. This

[PATCH v2] net/mlx4_en: Fix an error handling path in 'mlx4_en_init_netdev()'

2018-05-10 Thread Christophe JAILLET
t;net/mlx4_en: Refactor the XDP forwarding rings scheme") Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- v1 -> v2 : rewrite the fix as explained by Tariq Toukan (this 2nd version may have been posted twice, once without the v2 tag. PLease i

[PATCH] net/mlx4_en: Fix an error handling path in 'mlx4_en_init_netdev()'

2018-05-10 Thread Christophe JAILLET
t;net/mlx4_en: Refactor the XDP forwarding rings scheme") Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_net

[PATCH] net/mlx4_en: Fix an error handling path in 'mlx4_en_init_netdev()'

2018-05-08 Thread Christophe JAILLET
If the 2nd memory allocation of the loop fails, we must undo the memory allocation done so far. Fixes: 67f8b1dcb9ee ("net/mlx4_en: Refactor the XDP forwarding rings scheme") Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/mellanox/mlx4

[PATCH] net: aquantia: Fix an error handling path in 'aq_pci_probe()'

2018-05-08 Thread Christophe JAILLET
The position of 2 labels should be swapped in order to release resources in the correct order and avoid leaks. Fixes: 23ee07ad3c2f ("net: aquantia: Cleanup pci functions module") Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- The order of 'pci

[PATCH v2] net: ethernet: arc: Fix a potential memory leak if an optional regulator is deferred

2018-03-18 Thread Christophe JAILLET
If the optional regulator is deferred, we must release some resources. They will be re-allocated when the probe function will be called again. Fixes: 6eacf31139bf ("ethernet: arc: Add support for Rockchip SoC layer device tree bindings") Signed-off-by: Christophe JAILLET <ch

Re: [PATCH] net: ethernet: arc: Fix a potential memory leak if an optional regulator is deferred

2018-03-16 Thread Christophe JAILLET
Le 16/03/2018 à 20:27, David Miller a écrit : From: Christophe JAILLET <christophe.jail...@wanadoo.fr> Date: Wed, 14 Mar 2018 22:09:34 +0100 diff --git a/drivers/net/ethernet/arc/emac_rockchip.c b/drivers/net/ethernet/arc/emac_rockchip.c index 16f9bee992fe..8ee9dfd0e363 100644 --- a/d

[PATCH] net: ethernet: arc: Fix a potential memory leak if an optional regulator is deferred

2018-03-14 Thread Christophe JAILLET
If the optional regulator is deferrred, we must release some resources. They will be re-allocated when the probe function will be called again. Fixes: 6eacf31139bf ("ethernet: arc: Add support for Rockchip SoC layer device tree bindings") Signed-off-by: Christophe JAILLET <ch

Re: [PATCH] net/mlx4_en: Fix a memory leak in case of error in 'mlx4_en_init_netdev()'

2018-03-12 Thread Christophe Jaillet
Le 12/03/2018 à 09:42, Tariq Toukan a écrit : > > > On 12/03/2018 12:45 AM, Christophe JAILLET wrote: >> If 'kzalloc' fails, we must free some memory before returning. >> >> Fixes: 67f8b1dcb9ee ("net/mlx4_en: Refactor the XDP forwarding rings >> scheme&

[PATCH] net/mlx4_en: Fix a memory leak in case of error in 'mlx4_en_init_netdev()'

2018-03-11 Thread Christophe JAILLET
If 'kzalloc' fails, we must free some memory before returning. Fixes: 67f8b1dcb9ee ("net/mlx4_en: Refactor the XDP forwarding rings scheme") Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 +- 1 file chan

[PATCH] cxgb4: Fix error handling path in 'init_one()'

2018-02-06 Thread Christophe JAILLET
Commit baf5086840ab1 ("cxgb4: restructure VF mgmt code") has reordered some code but an error handling label has not been updated accordingly. So fix it and free 'adapter' if 't4_wait_dev_ready()' fails. Fixes: baf5086840ab1 ("cxgb4: restructure VF mgmt code") Signed-off-by

[PATCH] igb: Fix a test with HWTSTAMP_TX_ON

2018-02-06 Thread Christophe JAILLET
hwtstamp_config' in 'include/uapi/linux/net_tstamp.h' This fixes a warning reported by smatch: igb_xmit_frame_ring() warn: bit shifter 'HWTSTAMP_TX_ON' used for logical '&' Fixes: 26bd4e2db06be ("igb: protect TX timestamping from API misuse") Signed-off-by: Christophe JAILLET &l

[PATCH] mdio-sun4i: Fix a memory leak

2018-01-06 Thread Christophe JAILLET
If the probing of the regulator is deferred, the memory allocated by 'mdiobus_alloc_size()' will be leaking. It should be freed before the next call to 'sun4i_mdio_probe()' which will reallocate it. Fixes: 4bdcb1dd9feb ("net: Add MDIO bus driver for the Allwinner EMAC") Signed-off-by:

[PATCH] bnxt_en: Fix an error handling path in 'bnxt_get_module_eeprom()'

2017-11-21 Thread Christophe JAILLET
(success) is returned. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- Un-tested. If not testing the result of the 2nd call was done on purpose, it should be documented. --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 del

[PATCH] net: vxge: Fix some indentation issues

2017-11-19 Thread Christophe JAILLET
Some statements are not enough or too much indented. Fix it to improve readalbility. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/neterion/vxge/vxge-main.c | 37 +- 1 file changed, 18 insertions(+), 19 deletions(-) diff

[PATCH 1/4] fsl/fman: Remove a useless call to 'dev_set_drvdata()'

2017-11-06 Thread Christophe JAILLET
Commit c6e26ea8c893 ("dpaa_eth: change device used") has removed usage of 'dev_set_drvdata()' in the 'mac_probe() function. This call should also be axed. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/freescale/fman/mac.c | 1 - 1

[PATCH 3/4] fsl/fman: Add a missing 'of_node_put()' call in an error handling path

2017-11-06 Thread Christophe JAILLET
If 'of_phy_find_device()' fails, we must undo the previous 'of_node_get()' call, as done the the following error handling code. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/freescale/fman/mac.c | 1 + 1 file changed, 1 insertion(+) diff

[PATCH 4/4] fsl/fman: Remove a useless 'dev_err()' call

2017-11-06 Thread Christophe JAILLET
Memory allocation functions already display some informaton in case of memory allocation failure. There is no need to add an extra 'dev_err' here. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/freescale/fman/mac.c | 1 - 1 file changed, 1 de

[PATCH 2/4] fsl/fman: Remove some useless code

2017-11-06 Thread Christophe JAILLET
. This is useless (priv->fixed_link is NULL at this point), but at least it is consistent. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/freescale/fman/mac.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net

[PATCH 0/4] fsl/fman: Fix some error handling code in mac_probe

2017-11-06 Thread Christophe JAILLET
dling path in the function. The 2nd one removes some devm_iounmap/release/kfree functions which look useless to me. The 3rd one fixes a missing of_node_put. The 4th one is just cosmetic and removes a useless message. Christophe JAILLET (4): fsl/fman: Remove a useless call to 'dev_set_drvdata()'

[PATCH] net: hns3: Fix an error handling path in 'hclge_rss_init_hw()'

2017-09-29 Thread Christophe JAILLET
If this sanity check fails, we must free 'rss_indir'. Otherwise there is a memory leak. 'goto err' as done in the other error handling paths to fix it. Fixes: 46a3df9f9718 ("net: hns3: Fix for setting rss_size incorrectly") Signed-off-by: Christophe JAILLET <christophe.jail.

[PATCH] cnic: Fix an error handling path in 'cnic_alloc_bnx2x_resc()'

2017-09-21 Thread Christophe JAILLET
All the error handling paths 'goto error', except this one. We should also go to error in this case, or some resources will be leaking. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/broadcom/cnic.c | 2 +- 1 file changed, 1 insertion(+), 1 de

[PATCH v2] openvswitch: Fix an error handling path in 'ovs_nla_init_match_and_action()'

2017-09-11 Thread Christophe JAILLET
All other error handling paths in this function go through the 'error' label. This one should do the same. Fixes: 9cc9a5cb176c ("datapath: Avoid using stack larger than 1024.") Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- I think that the comment above th

[PATCH] datapath: Fix an error handling path in 'ovs_nla_init_match_and_action()'

2017-09-11 Thread Christophe JAILLET
All other error handling paths in this function go through the 'error' label. This one should do the same. Fixes: 9cc9a5cb176c ("datapath: Avoid using stack larger than 1024.") Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- I think that the comment above th

Re: [PATCH] igb: check memory allocation failure

2017-08-28 Thread Christophe JAILLET
Le 28/08/2017 à 01:09, Waskiewicz Jr, Peter a écrit : On 8/27/17 2:42 AM, Christophe JAILLET wrote: Check memory allocation failures and return -ENOMEM in such cases, as already done for other memory allocations in this function. This avoids NULL pointers dereference. Signed-off

[PATCH] igb: check memory allocation failure

2017-08-27 Thread Christophe JAILLET
Check memory allocation failures and return -ENOMEM in such cases, as already done for other memory allocations in this function. This avoids NULL pointers dereference. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/intel/igb/igb_main.c | 2 ++

[PATCH] net: sxgbe: check memory allocation failure

2017-08-24 Thread Christophe JAILLET
Check memory allocation failure and return -ENOMEM in such a case, as already done few lines below for another memory allocation. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c | 2 ++ 1 file changed, 2 inse

Re: [PATCH] mt7601u: check memory allocation failure

2017-08-21 Thread Christophe JAILLET
Le 21/08/2017 à 23:41, Jakub Kicinski a écrit : On Mon, 21 Aug 2017 14:34:30 -0700, Jakub Kicinski wrote: On Mon, 21 Aug 2017 22:59:56 +0200, Christophe JAILLET wrote: Check memory allocation failure and return -ENOMEM in such a case, as already done a few lines below Signed-off

[PATCH v2] mt7601u: check memory allocation failure

2017-08-21 Thread Christophe JAILLET
Check memory allocation failure and return -ENOMEM in such a case, as already done a few lines below. As 'dev->tx_q' can be NULL, we also need to check for that in 'mt7601u_free_tx()', and return early. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- v2: avoid ano

[PATCH] mt7601u: check memory allocation failure

2017-08-21 Thread Christophe JAILLET
Check memory allocation failure and return -ENOMEM in such a case, as already done a few lines below Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/wireless/mediatek/mt7601u/dma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wi

[PATCH] ieee802154: ca8210: Fix a potential NULL pointer dereference

2017-08-20 Thread Christophe JAILLET
'spi' is known to be NULL, so we dereference a NULL pointer here. Use 'pr_crit()' instead of 'dev_crit()' to report the message. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ieee802154/ca8210.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-)

Re: [PATCH] net: ibm: emac: Fix some error handling path in 'emac_probe()'

2017-08-19 Thread Christophe JAILLET
Le 19/08/2017 à 15:22, Christian Lamparter a écrit : On Saturday, August 19, 2017 1:07:57 AM CEST Christophe JAILLET wrote: If 'irq_of_parse_and_map()' or 'of_address_to_resource()' fail, 'err' is known to be 0 at this point. So return -ENODEV instead in the first case and propagate the error

[PATCH v2] net: ibm: emac: Fix some error handling path in 'emac_probe()'

2017-08-19 Thread Christophe JAILLET
of the 'emac_instance struct' becomes redundant and is removed. While at it, turn a 'err != 0' test into an equivalent 'err' to be more consistent. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- v2: use of_iomap() to simplify code remove 'rsrc_regs' field of the 'emac_in

[PATCH] net: ibm: emac: Fix some error handling path in 'emac_probe()'

2017-08-18 Thread Christophe JAILLET
consistent. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/ibm/emac/core.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 95135d

[PATCH] qed: Fix a memory allocation failure test in 'qed_mcp_cmd_init()'

2017-08-06 Thread Christophe JAILLET
the 2 'kzalloc()' instead. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/qlogic/qed/qed_mcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp

[PATCH] i40e: Fix a potential NULL pointer dereference

2017-08-06 Thread Christophe JAILLET
If 'kzalloc()' fails, a NULL pointer will be dereferenced. Return an error code (-ENOMEM) instead. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/et

[PATCH] atm: zatm: Fix an error handling path in 'zatm_init_one()'

2017-07-17 Thread Christophe JAILLET
If 'dma_set_mask_and_coherent()' fails, we must undo the previous 'pci_request_regions()' call. Adjust corresponding 'goto' to jump at the right place of the error handling path. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/atm/zatm.c | 2 +- 1 file chan

[PATCH v2] iwlwifi: mvm: Fix a memory leak in an error handling path in 'iwl_mvm_sar_get_wgds_table()'

2017-07-14 Thread Christophe JAILLET
We should free 'wgds.pointer' here as done a few lines above in another error handling path. It was allocated within 'acpi_evaluate_object()'. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- v2: rebase after 7fe90e0e3d60 ("iwlwifi: mvm: refactor geo init&qu

[PATCH] iwlwifi: mvm: Fix a memory leak in an error handling path in 'iwl_mvm_sar_get_wgds_table()'

2017-07-11 Thread Christophe JAILLET
We should free 'wgds.pointer' here as done a few lines above in another error handling path. It was allocated within 'acpi_evaluate_object()'. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- A comment in '/drivers/acpi/acpica/utalloc.c' states that: /* [...] Note: The

[PATCH v2] mrf24j40: Fix en error handling path in 'mrf24j40_probe()'

2017-07-08 Thread Christophe JAILLET
If this check fails, we must release some resources as done everywhere else in this function before returning an error code. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- V2: initialization of ret in this erro path ws missing. Stupid me! --- drivers/net/ieee

[PATCH] mrf24j40: Fix en error handling path in 'mrf24j40_probe()'

2017-07-08 Thread Christophe JAILLET
If this check fails, we must release some resources as done everywhere else in this function before returning an error code. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ieee802154/mrf24j40.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH 3/3] net: stmmac: Make 'alloc_dma_[rt]x_desc_resources()' look even closer

2017-07-08 Thread Christophe JAILLET
'alloc_dma_[rt]x_desc_resources()' functions look very close. Remove a useless initialization and use the same label name for error handling path in order to get them even closer. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/stmicro/

[PATCH 1/3] net: stmmac: Fix error handling path in 'alloc_dma_rx_desc_resources()'

2017-07-08 Thread Christophe JAILLET
If the first 'kmalloc_array' within the loop fails, we should free what as already been allocated, as done in all other error handling path. Fixes: 54139cf3bb33 ("net: stmmac: adding multiple buffers for rx") Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr>

[PATCH 2/3] net: stmmac: Fix error handling path in 'alloc_dma_tx_desc_resources()'

2017-07-08 Thread Christophe JAILLET
If the first 'kmalloc_array' within the loop fails, we should free what as already been allocated, as done in all other error handling path. Fixes: ce736788e8a9 ("net: stmmac: adding multiple buffers for TX") Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr>

[PATCH 0/3] net: stmmac: Fixes and cleanups in 'alloc_dma_[rt]x_desc_resources()'

2017-07-08 Thread Christophe JAILLET
These patchs are all related to 'alloc_dma_[rt]x_desc_resources()' functions. The 2 first fix an error path where some resources are leaking. I've separated them into 2 patches because the issues have been introduced by 2 deferent commits. The 3rd patch is just a clean-up. Christophe JAILLET (3

[PATCH] cisco: enic: Fic an error handling path in 'vnic_dev_init_devcmd2()'

2017-07-07 Thread Christophe JAILLET
: add devcmd2") Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/cisco/enic/vnic_dev.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/cisco/enic/vnic_dev.c b/drivers/net/ethernet/cisco/enic/

[PATCH] arcnet: com20020-pci: Fix an error handling path in 'com20020pci_probe()'

2017-07-06 Thread Christophe JAILLET
If this memory allocation fails, we should go through the error handling path as done everywhere else in this function before returning. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/arcnet/com20020-pci.c | 6 -- 1 file changed, 4 insertions

[PATCH v2] brcmfmac: Fix a memory leak in error handling path in 'brcmf_cfg80211_attach'

2017-06-20 Thread Christophe JAILLET
If 'wiphy_new()' fails, we leak 'ops'. Add a new label in the error handling path to free it in such a case. Cc: sta...@vger.kernel.org Fixes: 5c22fb85102a7 ("brcmfmac: add wowl gtk rekeying offload support") Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --

[PATCH] cfg80211: Fix a memory leak in error handling path in 'brcmf_cfg80211_attach'

2017-06-20 Thread Christophe JAILLET
If 'wiphy_new()' fails, we leak 'ops'. Add a new label in the error handling path to free it in such a case. Fixes: 5c22fb85102a7 ("brcmfmac: add wowl gtk rekeying offload support") Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/wireless/br

[PATCH] net: dsa: loop: Free resources if initialization is deferred

2017-05-09 Thread Christophe JAILLET
Free some devm'allocated memory in case of deferred driver initialization. This avoid to waste some memory in such a case. Suggested-by: Joe Perches <j...@perches.com> Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/dsa/dsa_loop.c | 5 - 1 fil

[PATCH] net: dsa: loop: Check for memory allocation failure

2017-05-05 Thread Christophe JAILLET
If 'devm_kzalloc' fails, a NULL pointer will be dereferenced. Return -ENOMEM instead, as done for some other memory allocation just a few lines above. Fixes: 98cd1552ea27 ("net: dsa: Mock-up driver") Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> ---

[PATCH] wcn36xx: Fix error handling

2017-02-19 Thread Christophe JAILLET
Reorder 'out_free_dxe_pool' and 'out_free_dxe_ctl' error handling labels in order to match the way resources have been allocated. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/wireless/ath/wcn36xx/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 del

[PATCH] qlcnic: Fix a memory leak in error handling path

2017-02-19 Thread Christophe JAILLET
If 'dma_alloc_coherent()' fails, we should release resources allocated so far, just as done in all other cases in this function. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- checkpatch.pl complains about '== NULL'. I have left it as-is because both '=

[PATCH] net: mvpp2: Fix a memory leak in error handling path

2017-02-19 Thread Christophe JAILLET
if 'devm_kzalloc()' fails, we should release resources allocated so far, just as done a few lines below. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/marvell/mvpp2.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/d

[PATCH 1/2] net: fs_enet: Fix an error handling path

2017-02-10 Thread Christophe JAILLET
'of_node_put(fpi->phy_node)' should also be called if we branch to 'out_deregister_fixed_link' error handling path. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 2/2] net: fs_enet: Simplify code

2017-02-10 Thread Christophe JAILLET
There is no need to use an intermediate variable to handle an error code in this case. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- I think that the remaining use of 'err' a few lines above could also be dropped. However, it could change the return value (i.e. propa

[PATCH] bnxt_en: Fix a VXLAN vs GENEVE issue

2016-11-21 Thread Christophe JAILLET
2 constants, the TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_GENEVE can not trigger. Replace the bit test that overlap by an equality test, just as in 'bnxt_hwrm_tunnel_dst_port_free()' above. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- Compile-tested only --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 12 +-

Spurious code in commit 1bf40ada6290 ("amd-xgbe: Add support for clause 37 auto-negotiation"

2016-11-12 Thread Marion &amp; Christophe JAILLET
Hi, in commit 1bf40ada6290 ("amd-xgbe: Add support for clause 37 auto-negotiation"), we can find: diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-common.h b/drivers/net/ethernet/amd/xgbe/xgbe-common.h index 695e982..8bcf4ef 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-common.h +++

[PATCH] net/mlx5: Simplify a test

2016-11-01 Thread Christophe JAILLET
'create_root_ns()' does not return an error pointer, so the test can be simplified to be more consistent. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH] wan/fsl_ucc_hdlc: Fix size used in dma_free_coherent()

2016-10-07 Thread Christophe JAILLET
'%s'" % (y0, y1) //// Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- Untested --- drivers/net/wan/fsl_ucc_hdlc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c index 5fbf8

[PATCH] ptp: Fix resource leak in case of error

2016-10-02 Thread Christophe JAILLET
(...); ... if (...) { ... } ... if (...) { ... goto l; } ... * l: ... when != ida_simple_remove(...); Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- Compile-tested only --- drivers/ptp/ptp_clock.c | 1 + 1 file changed, 1 ins

[PATCH resend] sctp: Remove some redundant code

2016-09-16 Thread Christophe JAILLET
already do the same. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> Acked-by: Marcelo Ricardo Leitner <marcelo.leit...@gmail.com> Acked-by: Neil Horman <nhor...@tuxdriver.com> --- Resent because netdev@ was not in copy Acked-by tags added --- net/sctp/ulpqueue.

Re: [PATCH] net: inet: diag: Fix an error handling

2016-09-12 Thread Christophe JAILLET
Le 12/09/2016 à 16:35, David Ahern a écrit : On 9/12/16 12:02 AM, Christophe JAILLET wrote: diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index abfbe492ebfe..795af25cf84c 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c @@ -1134,7 +1134,6 @@ int inet_diag_handler_get_info

[PATCH] net: inet: diag: Fix an error handling

2016-09-12 Thread Christophe JAILLET
)) { ... * f(<+... x ...+>); ... } Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- net/ipv4/inet_diag.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index abfbe492ebfe..795af25cf84c 100644 --

[PATCH] drivers: net: phy: xgene: Fix 'remove' function

2016-09-11 Thread Christophe JAILLET
If 'IS_ERR(pdata->clk)' is true, then 'clk_disable_unprepare(pdata->clk)' will do nothing. It is likely that 'if (!IS_ERR(pdata->clk))' was expected here. In fact, the test can even be removed because 'clk_disable_unprepare' already handles such cases. Signed-off-by: Christoph

Re: [PATCH] RDS: Simplify code

2016-09-04 Thread Christophe JAILLET
Le 04/09/2016 à 14:20, Leon Romanovsky a écrit : On Sat, Sep 03, 2016 at 07:33:29AM +0200, Christophe JAILLET wrote: Calling 'list_splice' followed by 'INIT_LIST_HEAD' is equivalent to 'list_splice_init'. It is not 100% accurate list_splice(y, z) INIT_LIST_HEAD(y) ==> if (!list_empt

[PATCH] RDS: Simplify code

2016-09-02 Thread Christophe JAILLET
Calling 'list_splice' followed by 'INIT_LIST_HEAD' is equivalent to 'list_splice_init'. This has been spotted with the following coccinelle script: / @@ expression y,z; @@ - list_splice(y,z); - INIT_LIST_HEAD(y); + list_splice_init(y,z); Signed-off-by: Christophe JAILLET

[PATCH] mwifiex: scan: Simplify code

2016-08-31 Thread Christophe JAILLET
This patch: - improves code layout - removes a useless memset(0) for some memory allocated with kzalloc - removes a useless if. We know that 'if (chan_band_tlv)' will succeed because it has been tested a few lines above Signed-off-by: Christophe JAILLET <christophe.j

Re: [PATCH] wan-cosa: Use memdup_user() rather than duplicating its implementation

2016-08-20 Thread Christophe JAILLET
Le 20/08/2016 à 10:25, SF Markus Elfring a écrit : From: Markus Elfring Date: Sat, 20 Aug 2016 10:10:12 +0200 Reuse existing functionality from memdup_user() instead of keeping duplicate source code. This issue was detected by using the Coccinelle software.

[PATCH 1/2] mwifiex: fix the length parameter of a memset

2016-08-08 Thread Christophe JAILLET
-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c index e06647a..7

[PATCH 2/2] mwifiex: simplify length computation for some memset

2016-08-08 Thread Christophe JAILLET
This patch should be a no-op. It just simplifies code by using the name of a variable instead of its type when calling 'sizeof'. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 4 ++-- 1 file changed, 2 insertions

[PATCH] drivers: atm: nicstar: Use the correct function to free some resources

2016-07-17 Thread Christophe JAILLET
In 'get_scq', 'dma_alloc_coherent' has been used to allocate some resources, so we need to free them using 'dma_free_coherent' instead of 'kfree'. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/atm/nicstar.c | 3 ++- 1 file changed, 2 insertions(+), 1 de

[PATCH] net: ti: cpmac: Use the correct function to free some resources.

2016-07-17 Thread Christophe JAILLET
-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- Un-compiled (I don't have the configuration for that) and un-tested --- drivers/net/ethernet/ti/cpmac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/c

[PATCH] mlxsw: spectrum_router: Return -ENOENT in case of error

2016-07-14 Thread Christophe JAILLET
'vr' should be a valid pointer here, so returning 'PTR_ERR(vr)' is wrong. Return an explicit error code (-ENOENT) instead. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 2 +- 1 file changed, 1 insertion

[PATCH] fsl/fman: fix error handling

2016-07-03 Thread Christophe JAILLET
This is likely that checking 'fman->fifo_offset' instead of 'fman->cam_offset' is expected here. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- The type of 'fifo_offset' may also need to be changed. --- drivers/net/ethernet/freescale/fman/fman.c | 2 +- 1 fil

[PATCH] net/mlx4: Fix some indent inconsistancy

2016-07-02 Thread Christophe JAILLET
Silent a few smatch warnings about indentation. This include the removal of a 'return' statement in 'resource_tracker.c'. This 'return' will still be performed when breaking out of the corresponding 'switch' block. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- drive

[PATCH] ps3_gelic: fix memcpy parameter

2016-04-25 Thread Christophe JAILLET
The size allocated for target->hwinfo and the number of bytes copied in it should be consistent. Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- Untested drivers/net/ethernet/toshiba/ps3_gelic_wireless.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) d

Inconsistent use of size argument in kzalloc and memcpy in 'drivers/net/ethernet/toshiba/ps3_gelic_wireless.c'

2016-04-11 Thread Christophe JAILLET
Hi, while looking at potential clean-up, I ended on the following code which looks spurious to me. We allocate 'be16_to_cpu(scan_info->size)' bytes, but then copy 'scan_info->size'. This is not consistent. I don't know which one is the correct one. CJ ---

[PATCH] net: qlcnic: Deletion of unnecessary memset

2015-07-13 Thread Christophe JAILLET
There is no need to memset memory allocated with vzalloc. Signed-off-by: Christophe JAILLET christophe.jail...@wanadoo.fr --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net

[PATCH v2] brcmsmac: Use kstrdup to simplify code

2015-07-08 Thread Christophe JAILLET
Replace a kmalloc+strcpy by an equivalent kstrdup in order to improve readability. Signed-off-by: Christophe JAILLET christophe.jail...@wanadoo.fr --- v2: fix the subject drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git

[PATCH] mac80211: Use kstrdup to simplify code

2015-07-08 Thread Christophe JAILLET
Replace a kmalloc+strcpy by an equivalent kstrdup in order to improve readability. Signed-off-by: Christophe JAILLET christophe.jail...@wanadoo.fr --- drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/wireless