stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: s5p-sss: fix incorrect usage of scatterlists api
@ 2016-04-26  7:29 Marek Szyprowski
  2016-04-26  7:45 ` Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marek Szyprowski @ 2016-04-26  7:29 UTC (permalink / raw)
  To: linux-crypto, linux-samsung-soc
  Cc: Marek Szyprowski, Krzysztof Kozlowski, Herbert Xu,
	David S. Miller, Vladimir Zapolskiy, Bartlomiej Zolnierkiewicz,
	stable

sg_dma_len() macro can be used only on scattelists which are mapped, so
all calls to it before dma_map_sg() are invalid. Replace them by proper
check for direct sg segment length read.

Fixes: a49e490c7a8a ("crypto: s5p-sss - add S5PV210 advanced crypto engine support")
Fixes: 9e4a1100a445 ("crypto: s5p-sss - Handle unaligned buffers")
Cc: <stable@vger.kernel.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/crypto/s5p-sss.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index ac6d62b..2b3a0cf 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -327,7 +327,7 @@ static int s5p_set_outdata(struct s5p_aes_dev *dev, struct scatterlist *sg)
 {
 	int err;
 
-	if (!sg_dma_len(sg)) {
+	if (!sg->length) {
 		err = -EINVAL;
 		goto exit;
 	}
@@ -349,7 +349,7 @@ static int s5p_set_indata(struct s5p_aes_dev *dev, struct scatterlist *sg)
 {
 	int err;
 
-	if (!sg_dma_len(sg)) {
+	if (!sg->length) {
 		err = -EINVAL;
 		goto exit;
 	}
@@ -474,7 +474,7 @@ static void s5p_set_aes(struct s5p_aes_dev *dev,
 static bool s5p_is_sg_aligned(struct scatterlist *sg)
 {
 	while (sg) {
-		if (!IS_ALIGNED(sg_dma_len(sg), AES_BLOCK_SIZE))
+		if (!IS_ALIGNED(sg->length, AES_BLOCK_SIZE))
 			return false;
 		sg = sg_next(sg);
 	}
-- 
1.9.2


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

end of thread, other threads:[~2016-04-28  1:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-26  7:29 [PATCH] crypto: s5p-sss: fix incorrect usage of scatterlists api Marek Szyprowski
2016-04-26  7:45 ` Krzysztof Kozlowski
2016-04-26  8:48 ` Vladimir Zapolskiy
2016-04-28  1:21 ` Herbert Xu

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