Skip to content
Permalink
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: b593b6f ("sfc_ef100: statistics gathering")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
  • Loading branch information
JiangJias authored and intel-lab-lkp committed Dec 15, 2021
1 parent 5472f14 commit fc56ac03164889a206ee1b65187a8be7aa7b0f04
Showing 1 changed file with 3 additions and 0 deletions.
@@ -602,6 +602,9 @@ static size_t ef100_update_stats(struct efx_nic *efx,
struct rtnl_link_stats64 *core_stats)
{
__le64 *mc_stats = kmalloc(array_size(efx->num_mac_stats, sizeof(__le64)), GFP_ATOMIC);
if (!mc_stats)
return 0;

struct ef100_nic_data *nic_data = efx->nic_data;
DECLARE_BITMAP(mask, EF100_STAT_COUNT) = {};
u64 *stats = nic_data->stats;

0 comments on commit fc56ac0

Please sign in to comment.