]> git.baikalelectronics.ru Git - kernel.git/commit
enetc: Fix uninitialized struct dim_sample field usage
authorClaudiu Manoil <claudiu.manoil@nxp.com>
Fri, 17 Sep 2021 10:22:06 +0000 (13:22 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 19 Sep 2021 11:10:26 +0000 (12:10 +0100)
commit44130d71d70b36ce49dd191def11285b178a56d2
tree2f406e6d3c57ccc6292200ab610ce836e156f28f
parent66ab4b32e01ef7c72498e0f561aca642f1a9b7e2
enetc: Fix uninitialized struct dim_sample field usage

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: a7f064fee94d ("enetc: Add adaptive interrupt coalescing")
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/enetc/enetc.c