提交 1fb37b56 编写于 作者: G Gilad Ben-Yossef 提交者: Herbert Xu

crypto: ccree - don't attempt 0 len DMA mappings

Refuse to try mapping zero bytes as this may cause a fault
on some configurations / platforms and it seems the prev.
attempt is not enough and we need to be more explicit.
Signed-off-by: NGilad Ben-Yossef <gilad@benyossef.com>
Reported-by: NCorentin Labbe <clabbe.montjoie@gmail.com>
Fixes: ce0fc6db ("crypto: ccree - protect against empty or NULL
scatterlists")
Tested-by: NCorentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 c143a603
......@@ -258,6 +258,13 @@ static int cc_map_sg(struct device *dev, struct scatterlist *sg,
{
int ret = 0;
if (!nbytes) {
*mapped_nents = 0;
*lbytes = 0;
*nents = 0;
return 0;
}
*nents = cc_get_sgl_nents(dev, sg, nbytes, lbytes);
if (*nents > max_sg_nents) {
*nents = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册