diff mbox series

[net] enetc: Fix uninitialized struct dim_sample field usage

Message ID 20210917102206.20616-2-claudiu.manoil@nxp.com (mailing list archive)
State Accepted
Commit 9f7afa05c9522b086327929ae622facab0f0f72b
Delegated to: Netdev Maintainers
Headers show
Series [net] enetc: Fix uninitialized struct dim_sample field usage | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Claudiu Manoil Sept. 17, 2021, 10:22 a.m. UTC
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: ae0e6a5d1627 ("enetc: Add adaptive interrupt coalescing")
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
---
 drivers/net/ethernet/freescale/enetc/enetc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Sept. 19, 2021, 11:20 a.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Fri, 17 Sep 2021 13:22:06 +0300 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net] enetc: Fix uninitialized struct dim_sample field usage
    https://git.kernel.org/netdev/net/c/9f7afa05c952

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

Patch

diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
index 7f90c27c0e79..042327b9981f 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc.c
@@ -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++;