Skip to content

Commit

Permalink
enetc: Fix uninitialized struct dim_sample field usage
Browse files Browse the repository at this point in the history
The only struct dim_sample member that does not get
initialized by dim_update_sample() is comp_ctr. (There
is special API to initialize comp_ctr:
dim_update_sample_with_comps(), and it is currently used
only for RDMA.) comp_ctr is used to compute curr_stats->cmps
and curr_stats->cpe_ratio (see dim_calc_stats()) which in
turn are consumed by the rdma_dim_*() API.  Therefore,
functionally, the net_dim*() API consumers are not affected.
Nevertheless, fix the computation of statistics based
on an uninitialized variable, even if the mentioned statistics
are not used at the moment.

Fixes: ae0e6a5 ("enetc: Add adaptive interrupt coalescing")
Signed-off-by: Claudiu Manoil <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
claudiu-m authored and davem330 committed Sep 19, 2021
1 parent 7237a49 commit 9f7afa0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/freescale/enetc/enetc.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ static void enetc_rx_dim_work(struct work_struct *w)

static void enetc_rx_net_dim(struct enetc_int_vector *v)
{
struct dim_sample dim_sample;
struct dim_sample dim_sample = {};

v->comp_cnt++;

Expand Down

0 comments on commit 9f7afa0

Please sign in to comment.