All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: pthombar@cadence.com
Cc: linux-spi@vger.kernel.org
Subject: [bug report] spi: cadence: add support for Cadence XSPI controller
Date: Fri, 1 Oct 2021 15:25:00 +0300	[thread overview]
Message-ID: <20210930134231.GA14363@kili> (raw)

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

                 reply	other threads:[~2021-10-01 12:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210930134231.GA14363@kili \
    --to=dan.carpenter@oracle.com \
    --cc=linux-spi@vger.kernel.org \
    --cc=pthombar@cadence.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 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.