netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cnic: issue with double assignment to ictx->xstorm_st_context.common.flags
@ 2021-04-09 10:29 Colin Ian King
  0 siblings, 0 replies; only message in thread
From: Colin Ian King @ 2021-04-09 10:29 UTC (permalink / raw)
  To: Vladislav Zolotarov, Michael Chan, Bhanu Prakash Gollapudi,
	Eilon Greenstein
  Cc: David S. Miller, Jakub Kicinski, Saurav Kashyap, Javed Hasan,
	GR-QLogic-Storage-Upstream, Nilesh Javali, Manish Rangankar,
	netdev, linux-kernel

Hi,

Analysis of linux with Coverity has detected an issue with the
assignment of ictx->xstorm_st_context.common.fla in
drivers/net/ethernet/broadcom/cnic.c in function cnic_setup_bnx2x_ctx.

This was introduced a while back with the following commit:

commit 619c5cb6885b936c44ae1422ef805b69c6291485
Author: Vlad Zolotarov <vladz@broadcom.com>
Date:   Tue Jun 14 14:33:44 2011 +0300

    New 7.0 FW: bnx2x, cnic, bnx2i, bnx2fc

The static analysis is as follows:

1761        ictx->xstorm_st_context.common.flags =

Unused value (UNUSED_VALUE)assigned_value: Assigning value 1 to
ictx->xstorm_st_context.common.flags here, but that stored value is
overwritten before it can be used.

1762                1 <<
XSTORM_COMMON_CONTEXT_SECTION_PHYSQ_INITIALIZED_SHIFT;
1763        ictx->xstorm_st_context.common.flags =

    value_overwrite: Overwriting previous write to
ictx->xstorm_st_context.common.flags with value from port << 1.

1764                port << XSTORM_COMMON_CONTEXT_SECTION_PBF_PORT_SHIFT;
1765
1766        ictx->tstorm_st_context.iscsi.hdr_bytes_2_fetch =
ISCSI_HEADER_SIZE;

The re-assignment of ictx->xstorm_st_context.common.flags in line 1763
is overwriting the value assigned on line 1761.  Should the = operator
on the re-assignment be an |= operator instead?

Colin

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-09 10:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 10:29 cnic: issue with double assignment to ictx->xstorm_st_context.common.flags Colin Ian King

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).