diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2016-04-26 03:29:26 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-04-27 21:15:50 -0400 |
commit | d1497977fecb9acce05988d6322ad415ef93bb39 (patch) | |
tree | 85d7f633720aa26082a351e3472e2a664e040113 /drivers/crypto/s5p-sss.c | |
parent | 6f6438975d6a1afb0f0ac18176ede4e667020db0 (diff) |
crypto: s5p-sss - fix incorrect usage of scatterlists api
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")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/s5p-sss.c')
-rw-r--r-- | drivers/crypto/s5p-sss.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c index ac6d62b3be07..2b3a0cfe3331 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) | |||
327 | { | 327 | { |
328 | int err; | 328 | int err; |
329 | 329 | ||
330 | if (!sg_dma_len(sg)) { | 330 | if (!sg->length) { |
331 | err = -EINVAL; | 331 | err = -EINVAL; |
332 | goto exit; | 332 | goto exit; |
333 | } | 333 | } |
@@ -349,7 +349,7 @@ static int s5p_set_indata(struct s5p_aes_dev *dev, struct scatterlist *sg) | |||
349 | { | 349 | { |
350 | int err; | 350 | int err; |
351 | 351 | ||
352 | if (!sg_dma_len(sg)) { | 352 | if (!sg->length) { |
353 | err = -EINVAL; | 353 | err = -EINVAL; |
354 | goto exit; | 354 | goto exit; |
355 | } | 355 | } |
@@ -474,7 +474,7 @@ static void s5p_set_aes(struct s5p_aes_dev *dev, | |||
474 | static bool s5p_is_sg_aligned(struct scatterlist *sg) | 474 | static bool s5p_is_sg_aligned(struct scatterlist *sg) |
475 | { | 475 | { |
476 | while (sg) { | 476 | while (sg) { |
477 | if (!IS_ALIGNED(sg_dma_len(sg), AES_BLOCK_SIZE)) | 477 | if (!IS_ALIGNED(sg->length, AES_BLOCK_SIZE)) |
478 | return false; | 478 | return false; |
479 | sg = sg_next(sg); | 479 | sg = sg_next(sg); |
480 | } | 480 | } |