* Potential issue setting vid_regs in Rockchip AXI PCIe endpoint controller driver
@ 2019-10-09 10:18 Colin Ian King
0 siblings, 0 replies; only message in thread
From: Colin Ian King @ 2019-10-09 10:18 UTC (permalink / raw)
To: Shawn Lin, linux-rockchip, Bjorn Helgaas; +Cc: linux-kernel
Hi,
Static analysis with Coverity has detected a potential issue in the
Rockchip AXI PCIe endpoint controller driver. The issue is in
drivers/pci/controller/pcie-rockchip-ep.c, function
rockchip_pcie_ep_write_header:
The coverity report is as follows:
124 static int rockchip_pcie_ep_write_header(struct pci_epc *epc, u8 fn,
125 struct pci_epf_header *hdr)
126 {
127 struct rockchip_pcie_ep *ep = epc_get_drvdata(epc);
128 struct rockchip_pcie *rockchip = &ep->rockchip;
129
130 /* All functions share the same vendor ID with function 0 */
131 if (fn == 0) {
132 u32 vid_regs = (hdr->vendorid & GENMASK(15, 0)) |
CID 12883 (#1 of 1): Operands don't affect result
(CONSTANT_EXPRESSION_RESULT) result_independent_of_operands:
hdr->subsys_vendor_id & (4294901760UL /* ~0UL - (1UL << 16) + 1 & (~0UL
>> 64 - 1 - 31) */) is always 0 regardless of the values of its
operands. This occurs as a value.
133 (hdr->subsys_vendor_id & GENMASK(31,
16)) << 16;
The expression (hdr->subsys_vendor_id & GENMASK(31, 16)) << 16 always
results in zero. Since the GENMASK gets the top 16 bits of
hdr->subsys_vendor_id then it looks like the 16 bit left shift is not
required, but I don't know if that is a correct assumption or not.
Colin
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-10-09 10:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09 10:18 Potential issue setting vid_regs in Rockchip AXI PCIe endpoint controller driver 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).