[bug report] spi: cadence: add support for Cadence XSPI controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Parshuram Thombare,

The patch a16cc8077627: "spi: cadence: add support for Cadence XSPI
controller" from Sep 19, 2021, leads to the following
Smatch static checker warning:

	drivers/spi/spi-cadence-xspi.c:244 cdns_xspi_trigger_command()
	error: buffer overflow 'cmd_regs' 5 <= 5

drivers/spi/spi-cadence-xspi.c
    241 static void cdns_xspi_trigger_command(struct cdns_xspi_dev *cdns_xspi,
    242                                       u32 cmd_regs[5])
                                              ^^^^^^^^^^^^^^^

    243 {
--> 244         writel(cmd_regs[5], cdns_xspi->iobase + CDNS_XSPI_CMD_REG_5);
                       ^^^^^^^^^^^
This is off by one.

    245         writel(cmd_regs[4], cdns_xspi->iobase + CDNS_XSPI_CMD_REG_4);
    246         writel(cmd_regs[3], cdns_xspi->iobase + CDNS_XSPI_CMD_REG_3);
    247         writel(cmd_regs[2], cdns_xspi->iobase + CDNS_XSPI_CMD_REG_2);
    248         writel(cmd_regs[1], cdns_xspi->iobase + CDNS_XSPI_CMD_REG_1);
    249         writel(cmd_regs[0], cdns_xspi->iobase + CDNS_XSPI_CMD_REG_0);
    250 }

regards,
dan carpenter



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux