linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: cadence: fix static checker warning
@ 2021-10-03  7:04 Parshuram Thombare
  2021-10-04  6:49 ` Dan Carpenter
  2021-10-04 17:02 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Parshuram Thombare @ 2021-10-03  7:04 UTC (permalink / raw)
  To: broonie, dan.carpenter
  Cc: linux-spi, linux-kernel, jpawar, mparab, Parshuram Thombare

This patch fixes Smatch static checker warning.
CDNS_XSPI_CMD_REG_5 is used in ACMD mode and currently
only STIG mode is enabled which doesn't use CDNS_XSPI_CMD_REG_5
and hence everything was working in STIG mode.
Since plan is to use same function cdns_xspi_trigger_command()
in ACMD mode, increasing size of the array passed to it.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/linux-spi/20210930134231.GA14363@kili/
Signed-off-by: Parshuram Thombare <pthombar@cadence.com>
---
 drivers/spi/spi-cadence-xspi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-cadence-xspi.c b/drivers/spi/spi-cadence-xspi.c
index 3401fcf..6bd0e67 100644
--- a/drivers/spi/spi-cadence-xspi.c
+++ b/drivers/spi/spi-cadence-xspi.c
@@ -239,7 +239,7 @@ static int cdns_xspi_wait_for_controller_idle(struct cdns_xspi_dev *cdns_xspi)
 }
 
 static void cdns_xspi_trigger_command(struct cdns_xspi_dev *cdns_xspi,
-				      u32 cmd_regs[5])
+				      u32 cmd_regs[6])
 {
 	writel(cmd_regs[5], cdns_xspi->iobase + CDNS_XSPI_CMD_REG_5);
 	writel(cmd_regs[4], cdns_xspi->iobase + CDNS_XSPI_CMD_REG_4);
@@ -346,7 +346,7 @@ static int cdns_xspi_send_stig_command(struct cdns_xspi_dev *cdns_xspi,
 				       const struct spi_mem_op *op,
 				       bool data_phase)
 {
-	u32 cmd_regs[5];
+	u32 cmd_regs[6];
 	u32 cmd_status;
 	int ret;
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] spi: cadence: fix static checker warning
  2021-10-03  7:04 [PATCH] spi: cadence: fix static checker warning Parshuram Thombare
@ 2021-10-04  6:49 ` Dan Carpenter
  2021-10-04 17:02 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-10-04  6:49 UTC (permalink / raw)
  To: Parshuram Thombare; +Cc: broonie, linux-spi, linux-kernel, jpawar, mparab

On Sun, Oct 03, 2021 at 09:04:18AM +0200, Parshuram Thombare wrote:
> This patch fixes Smatch static checker warning.
> CDNS_XSPI_CMD_REG_5 is used in ACMD mode and currently
> only STIG mode is enabled which doesn't use CDNS_XSPI_CMD_REG_5
> and hence everything was working in STIG mode.
> Since plan is to use same function cdns_xspi_trigger_command()
> in ACMD mode, increasing size of the array passed to it.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Link: https://lore.kernel.org/linux-spi/20210930134231.GA14363@kili/ 
> Signed-off-by: Parshuram Thombare <pthombar@cadence.com>

Thanks!  There are runtime tools which will detect this read overflow
so let's add a Fixes tag.

Fixes: a16cc8077627 ("spi: cadence: add support for Cadence XSPI controller")

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] spi: cadence: fix static checker warning
  2021-10-03  7:04 [PATCH] spi: cadence: fix static checker warning Parshuram Thombare
  2021-10-04  6:49 ` Dan Carpenter
@ 2021-10-04 17:02 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-10-04 17:02 UTC (permalink / raw)
  To: Parshuram Thombare, dan.carpenter
  Cc: Mark Brown, linux-spi, linux-kernel, mparab, jpawar

On Sun, 3 Oct 2021 09:04:18 +0200, Parshuram Thombare wrote:
> This patch fixes Smatch static checker warning.
> CDNS_XSPI_CMD_REG_5 is used in ACMD mode and currently
> only STIG mode is enabled which doesn't use CDNS_XSPI_CMD_REG_5
> and hence everything was working in STIG mode.
> Since plan is to use same function cdns_xspi_trigger_command()
> in ACMD mode, increasing size of the array passed to it.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: cadence: fix static checker warning
      commit: 79bffb1e97a349238a0b5535c9356e48b987b8bd

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-04 17:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-03  7:04 [PATCH] spi: cadence: fix static checker warning Parshuram Thombare
2021-10-04  6:49 ` Dan Carpenter
2021-10-04 17:02 ` Mark Brown

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).