mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Vladislav Zolotarov <vladz@broadcom.com>,
	Michael Chan <mchan@broadcom.com>,
	Bhanu Prakash Gollapudi <bprakash@broadcom.com>,
	Eilon Greenstein <eilong@broadcom.com>
Cc: "David S. Miller" <davem@conan.davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Saurav Kashyap <skashyap@marvell.com>,
	Javed Hasan <jhasan@marvell.com>,
	GR-QLogic-Storage-Upstream@marvell.com,
	Nilesh Javali <njavali@marvell.com>,
	Manish Rangankar <mrangankar@marvell.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: cnic: issue with double assignment to ictx->xstorm_st_context.common.flags
Date: Fri, 9 Apr 2021 11:29:24 +0100	[thread overview]
Message-ID: <45fd66c6-764b-bc0d-7ff9-920db399f11b@canonical.com> (raw)

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

                 reply	other threads:[~2021-04-09 10:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45fd66c6-764b-bc0d-7ff9-920db399f11b@canonical.com \
    --to=colin.king@canonical.com \
    --cc=GR-QLogic-Storage-Upstream@marvell.com \
    --cc=bprakash@broadcom.com \
    --cc=davem@conan.davemloft.net \
    --cc=eilong@broadcom.com \
    --cc=jhasan@marvell.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchan@broadcom.com \
    --cc=mrangankar@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=njavali@marvell.com \
    --cc=skashyap@marvell.com \
    --cc=vladz@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®