From: Bjorn Helgaas <helgaas@kernel.org>
To: Shawn Lin <shawn.lin@rock-chips.com>
Cc: linux-pci@vger.kernel.org, Krzysztof Wilczynski <kw@linux.com>
Subject: Re: pcie-rockchip-ep.c coverity issue #1437163
Date: Wed, 23 Dec 2020 15:04:44 -0600 [thread overview]
Message-ID: <20201223210444.GA322275@bjorn-Precision-5520> (raw)
In-Reply-To: <60a290a9-678b-b08d-25b4-8299f2f2c916@rock-chips.com>
[+cc Krzysztof]
On Wed, Oct 28, 2020 at 08:34:45AM +0800, Shawn Lin wrote:
> On 2020/10/28 0:16, 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;
>
> Actually it should be BIT(0) instead of BIT(16),
> I will fix it, thanks.
Just a quick reminder about this and the similar issue in
rockchip_pcie_ep_send_msi_irq().
Your response above didn't seem to make it to the archive, so maybe
your patch to fix it also got lost?
Krzysztof also pointed out that rockchip_pcie_read() returns u32,
while flags is only u16.
Bjorn
next parent reply other threads:[~2020-12-23 21:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <60a290a9-678b-b08d-25b4-8299f2f2c916@rock-chips.com>
2020-12-23 21:04 ` Bjorn Helgaas [this message]
2020-12-24 0:55 ` pcie-rockchip-ep.c coverity issue #1437163 Shawn Lin
2020-10-27 16:16 Bjorn Helgaas
2020-10-27 16:37 ` Bjorn Helgaas
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=20201223210444.GA322275@bjorn-Precision-5520 \
--to=helgaas@kernel.org \
--cc=kw@linux.com \
--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).