All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] spi: cadence: add support for Cadence XSPI controller
@ 2021-10-01 12:25 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2021-10-01 12:25 UTC (permalink / raw)
  To: pthombar; +Cc: linux-spi

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-01 12:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01 12:25 [bug report] spi: cadence: add support for Cadence XSPI controller Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.