linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Shawn Lin <shawn.lin@rock-chips.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: pcie-rockchip-ep.c coverity issue #1437163
Date: Tue, 27 Oct 2020 11:37:01 -0500	[thread overview]
Message-ID: <20201027163701.GA184393@bjorn-Precision-5520> (raw)
In-Reply-To: <20201027161636.GA182618@bjorn-Precision-5520>

On Tue, Oct 27, 2020 at 11:16:38AM -0500, Bjorn Helgaas wrote:
> Hi Shawn,
> 
> Please take a look at this issue reported by Coverity:
> 
> 332 static int rockchip_pcie_ep_get_msi(struct pci_epc *epc, u8 fn)
> 333 {
> 334        struct rockchip_pcie_ep *ep = epc_get_drvdata(epc);
> 335        struct rockchip_pcie *rockchip = &ep->rockchip;
> 336        u16 flags;
> 337
> 338        flags = rockchip_pcie_read(rockchip,
> 339                                   ROCKCHIP_PCIE_EP_FUNC_BASE(fn) +
> 340                                   ROCKCHIP_PCIE_EP_MSI_CTRL_REG);
> 
> CID 1437163 (#2 of 2): Operands don't affect result
> (CONSTANT_EXPRESSION_RESULT) result_independent_of_operands: flags &
> (65536UL /* 1UL << 16 */) is always 0 regardless of the values of its
> operands. This occurs as the logical operand of !.
> 
> 341        if (!(flags & ROCKCHIP_PCIE_EP_MSI_CTRL_ME))
> 342                return -EINVAL;

The same issue also occurs in rockchip_pcie_ep_send_msi_irq()
(Coverity issue #143765 for that one).

  reply	other threads:[~2020-10-27 16:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 16:16 pcie-rockchip-ep.c coverity issue #1437163 Bjorn Helgaas
2020-10-27 16:37 ` Bjorn Helgaas [this message]
     [not found] <60a290a9-678b-b08d-25b4-8299f2f2c916@rock-chips.com>
2020-12-23 21:04 ` Bjorn Helgaas
2020-12-24  0:55   ` Shawn Lin

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=20201027163701.GA184393@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=shawn.lin@rock-chips.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;
as well as URLs for NNTP newsgroup(s).