linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND 0/2]spi: spi-zynq-qspi: Fix stack violation bug
@ 2021-04-29  5:38 Amit Kumar Mahapatra
  2021-04-29  5:38 ` [RESEND 1/2] spi: spi-zynq-qspi: Fix kernel-doc warning Amit Kumar Mahapatra
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Amit Kumar Mahapatra @ 2021-04-29  5:38 UTC (permalink / raw)
  To: broonie; +Cc: linux-spi, linux-kernel, git, Amit Kumar Mahapatra

This patch series fixes kernel-doc warnings and stack violation
issues in Zynq qspi driver.
---
Branch: for-next
---
Amit Kumar Mahapatra (1):
  spi: spi-zynq-qspi: Fix kernel-doc warning

Karen Dombroski (1):
  spi: spi-zynq-qspi: Fix stack violation bug

 drivers/spi/spi-zynq-qspi.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

-- 
2.17.1


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

* [RESEND 1/2] spi: spi-zynq-qspi: Fix kernel-doc warning
  2021-04-29  5:38 [RESEND 0/2]spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
@ 2021-04-29  5:38 ` Amit Kumar Mahapatra
  2021-04-29  5:38 ` [RESEND 2/2] spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
  2021-04-29 17:15 ` [RESEND 0/2]spi: " Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Amit Kumar Mahapatra @ 2021-04-29  5:38 UTC (permalink / raw)
  To: broonie; +Cc: linux-spi, linux-kernel, git, Amit Kumar Mahapatra

Fix kernel-doc warning.

Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
---
 drivers/spi/spi-zynq-qspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-zynq-qspi.c b/drivers/spi/spi-zynq-qspi.c
index 5d8a5ee62fa2..1acde9e24973 100644
--- a/drivers/spi/spi-zynq-qspi.c
+++ b/drivers/spi/spi-zynq-qspi.c
@@ -367,7 +367,7 @@ static int zynq_qspi_config_op(struct zynq_qspi *xqspi, struct spi_device *spi)
 }
 
 /**
- * zynq_qspi_setup - Configure the QSPI controller
+ * zynq_qspi_setup_op - Configure the QSPI controller
  * @spi:	Pointer to the spi_device structure
  *
  * Sets the operational mode of QSPI controller for the next QSPI transfer, baud
-- 
2.17.1


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

* [RESEND 2/2] spi: spi-zynq-qspi: Fix stack violation bug
  2021-04-29  5:38 [RESEND 0/2]spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
  2021-04-29  5:38 ` [RESEND 1/2] spi: spi-zynq-qspi: Fix kernel-doc warning Amit Kumar Mahapatra
@ 2021-04-29  5:38 ` Amit Kumar Mahapatra
  2021-04-29 17:15 ` [RESEND 0/2]spi: " Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Amit Kumar Mahapatra @ 2021-04-29  5:38 UTC (permalink / raw)
  To: broonie
  Cc: linux-spi, linux-kernel, git, Karen Dombroski, Amit Kumar Mahapatra

From: Karen Dombroski <karen.dombroski@marsbioimaging.com>

When the number of bytes for the op is greater than one, the read could
run off the end of the function stack and cause a crash.

This patch restores the behaviour of safely reading out of the original
opcode location.

Signed-off-by: Karen Dombroski <karen.dombroski@marsbioimaging.com>
Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
---
 drivers/spi/spi-zynq-qspi.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-zynq-qspi.c b/drivers/spi/spi-zynq-qspi.c
index 1acde9e24973..5a3d81c31d04 100644
--- a/drivers/spi/spi-zynq-qspi.c
+++ b/drivers/spi/spi-zynq-qspi.c
@@ -528,18 +528,17 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem,
 	struct zynq_qspi *xqspi = spi_controller_get_devdata(mem->spi->master);
 	int err = 0, i;
 	u8 *tmpbuf;
-	u8 opcode = op->cmd.opcode;
 
 	dev_dbg(xqspi->dev, "cmd:%#x mode:%d.%d.%d.%d\n",
-		opcode, op->cmd.buswidth, op->addr.buswidth,
+		op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
 		op->dummy.buswidth, op->data.buswidth);
 
 	zynq_qspi_chipselect(mem->spi, true);
 	zynq_qspi_config_op(xqspi, mem->spi);
 
-	if (op->cmd.nbytes) {
+	if (op->cmd.opcode) {
 		reinit_completion(&xqspi->data_completion);
-		xqspi->txbuf = &opcode;
+		xqspi->txbuf = (u8 *)&op->cmd.opcode;
 		xqspi->rxbuf = NULL;
 		xqspi->tx_bytes = op->cmd.nbytes;
 		xqspi->rx_bytes = op->cmd.nbytes;
-- 
2.17.1


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

* Re: [RESEND 0/2]spi: spi-zynq-qspi: Fix stack violation bug
  2021-04-29  5:38 [RESEND 0/2]spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
  2021-04-29  5:38 ` [RESEND 1/2] spi: spi-zynq-qspi: Fix kernel-doc warning Amit Kumar Mahapatra
  2021-04-29  5:38 ` [RESEND 2/2] spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
@ 2021-04-29 17:15 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-04-29 17:15 UTC (permalink / raw)
  To: Amit Kumar Mahapatra; +Cc: Mark Brown, git, linux-spi, linux-kernel

On Wed, 28 Apr 2021 23:38:00 -0600, Amit Kumar Mahapatra wrote:
> This patch series fixes kernel-doc warnings and stack violation
> issues in Zynq qspi driver.

Applied to

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

Thanks!

[1/2] spi: spi-zynq-qspi: Fix kernel-doc warning
      commit: 121271f08809e5dc01d15d3e529988ac5d740af6
[2/2] spi: spi-zynq-qspi: Fix stack violation bug
      commit: 6d5ff8e632a4f2389c331e5554cd1c2a9a28c7aa

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] 4+ messages in thread

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29  5:38 [RESEND 0/2]spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
2021-04-29  5:38 ` [RESEND 1/2] spi: spi-zynq-qspi: Fix kernel-doc warning Amit Kumar Mahapatra
2021-04-29  5:38 ` [RESEND 2/2] spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
2021-04-29 17:15 ` [RESEND 0/2]spi: " 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).