Commit 407ecd1b authored by 蒋家盛's avatar 蒋家盛 Committed by David S. Miller
Browse files

sfc_ef100: potential dereference of null pointer



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: b593b6f1 ("sfc_ef100: statistics gathering")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0546b224
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);