提交 d1497977 编写于 作者: M Marek Szyprowski 提交者: Herbert Xu

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: a49e490c ("crypto: s5p-sss - add S5PV210 advanced crypto engine support")
Fixes: 9e4a1100 ("crypto: s5p-sss - Handle unaligned buffers")
Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: NVladimir Zapolskiy <vz@mleia.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 6f643897
...@@ -327,7 +327,7 @@ static int s5p_set_outdata(struct s5p_aes_dev *dev, struct scatterlist *sg) ...@@ -327,7 +327,7 @@ static int s5p_set_outdata(struct s5p_aes_dev *dev, struct scatterlist *sg)
{ {
int err; int err;
if (!sg_dma_len(sg)) { if (!sg->length) {
err = -EINVAL; err = -EINVAL;
goto exit; goto exit;
} }
...@@ -349,7 +349,7 @@ static int s5p_set_indata(struct s5p_aes_dev *dev, struct scatterlist *sg) ...@@ -349,7 +349,7 @@ static int s5p_set_indata(struct s5p_aes_dev *dev, struct scatterlist *sg)
{ {
int err; int err;
if (!sg_dma_len(sg)) { if (!sg->length) {
err = -EINVAL; err = -EINVAL;
goto exit; goto exit;
} }
...@@ -474,7 +474,7 @@ static void s5p_set_aes(struct s5p_aes_dev *dev, ...@@ -474,7 +474,7 @@ static void s5p_set_aes(struct s5p_aes_dev *dev,
static bool s5p_is_sg_aligned(struct scatterlist *sg) static bool s5p_is_sg_aligned(struct scatterlist *sg)
{ {
while (sg) { while (sg) {
if (!IS_ALIGNED(sg_dma_len(sg), AES_BLOCK_SIZE)) if (!IS_ALIGNED(sg->length, AES_BLOCK_SIZE))
return false; return false;
sg = sg_next(sg); sg = sg_next(sg);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册