linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] octeontx2-af: Fix uninitialized variable val
@ 2021-09-17 11:57 Colin King
  2021-09-17 13:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2021-09-17 11:57 UTC (permalink / raw)
  To: Sunil Goutham, Linu Cherian, Geetha sowjanya, Jerin Jacob,
	hariprasad, Subbaraya Sundeep, David S . Miller, Jakub Kicinski,
	Srujana Challa, Vidya Sagar Velumuri, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

In the case where the condition !is_rvu_otx2(rvu) is false variable
val is not initialized and can contain a garbage value. Fix this by
initializing val to zero and bit-wise or'ing in BIT_ULL(51) to val
for the true condition case of !is_rvu_otx2(rvu).

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: 4b5a3ab17c6c ("octeontx2-af: Hardware configuration for inline IPsec")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
index ea3e03fa55d4..29b15b544bdc 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
@@ -4596,9 +4596,10 @@ static void nix_inline_ipsec_cfg(struct rvu *rvu, struct nix_inline_ipsec_cfg *r
 
 	cpt_idx = (blkaddr == BLKADDR_NIX0) ? 0 : 1;
 	if (req->enable) {
+		val = 0;
 		/* Enable context prefetching */
 		if (!is_rvu_otx2(rvu))
-			val = BIT_ULL(51);
+			val |= BIT_ULL(51);
 
 		/* Set OPCODE and EGRP */
 		val |= FIELD_PREP(IPSEC_GEN_CFG_EGRP, req->gen_cfg.egrp);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] octeontx2-af: Fix uninitialized variable val
  2021-09-17 11:57 [PATCH][next] octeontx2-af: Fix uninitialized variable val Colin King
@ 2021-09-17 13:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-09-17 13:10 UTC (permalink / raw)
  To: Colin King
  Cc: sgoutham, lcherian, gakula, jerinj, hkelam, sbhatta, davem, kuba,
	schalla, vvelumuri, netdev, kernel-janitors, linux-kernel

Hello:

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

On Fri, 17 Sep 2021 12:57:47 +0100 you wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> In the case where the condition !is_rvu_otx2(rvu) is false variable
> val is not initialized and can contain a garbage value. Fix this by
> initializing val to zero and bit-wise or'ing in BIT_ULL(51) to val
> for the true condition case of !is_rvu_otx2(rvu).
> 
> [...]

Here is the summary with links:
  - [next] octeontx2-af: Fix uninitialized variable val
    https://git.kernel.org/netdev/net-next/c/d853f1d3c900

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-17 13:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 11:57 [PATCH][next] octeontx2-af: Fix uninitialized variable val Colin King
2021-09-17 13:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).