All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] sfc_ef100: potential dereference of null pointer
@ 2021-12-15 14:37 Jiasheng Jiang
  2021-12-16 20:51 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2021-12-15 14:37 UTC (permalink / raw)
  To: ecree.xilinx, habetsm.xilinx, davem, kuba
  Cc: netdev, linux-kernel, Jiasheng Jiang, kernel test robot

The return value of kmalloc() needs to be checked.
To avoid use in efx_nic_update_stats() in case of the failure of alloc.

Fixes: b593b6f1b492 ("sfc_ef100: statistics gathering")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reported-by: kernel test robot <lkp@intel.com>
---
Changelog:

v1 -> v2

*Change 1. Change the place to check, avoiding the warning.
---
 drivers/net/ethernet/sfc/ef100_nic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
index 518268ce2064..d35cafd422b1 100644
--- a/drivers/net/ethernet/sfc/ef100_nic.c
+++ b/drivers/net/ethernet/sfc/ef100_nic.c
@@ -609,6 +609,9 @@ static size_t ef100_update_stats(struct efx_nic *efx,
 	ef100_common_stat_mask(mask);
 	ef100_ethtool_stat_mask(mask);
 
+	if (!mc_stats)
+		return 0;
+
 	efx_nic_copy_stats(efx, mc_stats);
 	efx_nic_update_stats(ef100_stat_desc, EF100_STAT_COUNT, mask,
 			     stats, mc_stats, false);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] sfc_ef100: potential dereference of null pointer
  2021-12-15 14:37 [PATCH v2] sfc_ef100: potential dereference of null pointer Jiasheng Jiang
@ 2021-12-16 20:51 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-16 20:51 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: ecree.xilinx, habetsm.xilinx, davem, kuba, netdev, linux-kernel, lkp

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed, 15 Dec 2021 22:37:31 +0800 you wrote:
> The return value of kmalloc() needs to be checked.
> To avoid use in efx_nic_update_stats() in case of the failure of alloc.
> 
> Fixes: b593b6f1b492 ("sfc_ef100: statistics gathering")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> Reported-by: kernel test robot <lkp@intel.com>
> 
> [...]

Here is the summary with links:
  - [v2] sfc_ef100: potential dereference of null pointer
    https://git.kernel.org/netdev/net/c/407ecd1bd726

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-16 20:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-15 14:37 [PATCH v2] sfc_ef100: potential dereference of null pointer Jiasheng Jiang
2021-12-16 20:51 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.