* [PATCH] spi: img-spfi: Verify max spfi transfer length
@ 2015-03-02 16:06 Sifan Naeem
2015-03-03 14:26 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Sifan Naeem @ 2015-03-02 16:06 UTC (permalink / raw)
To: broonie, abrestic; +Cc: linux-spi, linux-kernel, Sifan Naeem
Maximum transfer length supported by SPFI is 65535, this is limited
by the number of bits available in SPFI TSize register to represent
the transfer size.
For transfer requests larger than the maximum supported the driver
will return an invalid argument error.
Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
---
drivers/spi/spi-img-spfi.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c
index c01567d..e649bc7 100644
--- a/drivers/spi/spi-img-spfi.c
+++ b/drivers/spi/spi-img-spfi.c
@@ -459,6 +459,13 @@ static int img_spfi_transfer_one(struct spi_master *master,
unsigned long flags;
int ret;
+ if (xfer->len > SPFI_TRANSACTION_TSIZE_MASK) {
+ dev_err(spfi->dev,
+ "Transfer length (%d) is greater than the max supported (%d)",
+ xfer->len, SPFI_TRANSACTION_TSIZE_MASK);
+ return -EINVAL;
+ }
+
/*
* Stop all DMA and reset the controller if the previous transaction
* timed-out and never completed it's DMA.
--
1.7.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] spi: img-spfi: Verify max spfi transfer length
2015-03-02 16:06 [PATCH] spi: img-spfi: Verify max spfi transfer length Sifan Naeem
@ 2015-03-03 14:26 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-03-03 14:26 UTC (permalink / raw)
To: Sifan Naeem; +Cc: abrestic, linux-spi, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 350 bytes --]
On Mon, Mar 02, 2015 at 04:06:46PM +0000, Sifan Naeem wrote:
> Maximum transfer length supported by SPFI is 65535, this is limited
> by the number of bits available in SPFI TSize register to represent
> the transfer size.
> For transfer requests larger than the maximum supported the driver
> will return an invalid argument error.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-03 14:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-02 16:06 [PATCH] spi: img-spfi: Verify max spfi transfer length Sifan Naeem
2015-03-03 14:26 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®