From patchwork Tue Apr 26 07:29:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 66669 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1455926qge; Tue, 26 Apr 2016 00:29:51 -0700 (PDT) X-Received: by 10.66.182.161 with SMTP id ef1mr1458010pac.40.1461655791655; Tue, 26 Apr 2016 00:29:51 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id km6si3045134pab.153.2016.04.26.00.29.51; Tue, 26 Apr 2016 00:29:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752178AbcDZH3u (ORCPT + 4 others); Tue, 26 Apr 2016 03:29:50 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:35451 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752121AbcDZH3t (ORCPT ); Tue, 26 Apr 2016 03:29:49 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O68006O6CTM3M70@mailout2.w1.samsung.com>; Tue, 26 Apr 2016 08:29:46 +0100 (BST) X-AuditID: cbfec7f4-f796c6d000001486-88-571f18eaf815 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 9B.C4.05254.AE81F175; Tue, 26 Apr 2016 08:29:46 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O6800L30CTA2E90@eusync2.samsung.com>; Tue, 26 Apr 2016 08:29:46 +0100 (BST) From: Marek Szyprowski To: linux-crypto@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Krzysztof Kozlowski , Herbert Xu , "David S. Miller" , Vladimir Zapolskiy , Bartlomiej Zolnierkiewicz , stable@vger.kernel.org Subject: [PATCH] crypto: s5p-sss: fix incorrect usage of scatterlists api Date: Tue, 26 Apr 2016 09:29:26 +0200 Message-id: <1461655766-27346-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkluLIzCtJLcpLzFFi42I5/e/4Fd1XEvLhBvPPKllsnLGe1WLO+RYW i+5XMhavXxha3L/3k8lixvl9TBZrj9xlt1iw8RGjxf9fzcwOnB5bVt5k8th2QNXj38IpLB59 W1YxenzeJBfAGsVlk5Kak1mWWqRvl8CVsXjvc/aC31wVs4//Z25g/MzRxcjJISFgIrFs33E2 CFtM4sK99UA2F4eQwFJGievdS1lAEkICTUwS09/XgthsAoYSXW+7wBpEBJwlfjevYQWxmQVW MUksm5kOYgsLeErMf/cIrIZFQFVi67nzQDYHB6+Ah8SVjT4Qu+Qk/r9cwTSBkXsBI8MqRtHU 0uSC4qT0XEO94sTc4tK8dL3k/NxNjJCA+bKDcfExq0OMAhyMSjy8CsvkwoVYE8uKK3MPMUpw MCuJ8IYJyocL8aYkVlalFuXHF5XmpBYfYpTmYFES5527632IkEB6YklqdmpqQWoRTJaJg1Oq gbHhd9Os3j1LGmfzzqhJ+bF9Oed19ikyjlsq5jAUlgg4K2yd2b+Qr6vt91KGjJUpyf6+12+q d4YYsr+a9/Lk1/l8RmxbXc7LCKb/OrVEjX2W6RMO1u7mI/ONoxKz9G+JGs5orzGaMvmaX21e 9Lkgrzc2bI+Ep1xxZJCVObrr378lbl2F97wfnVJiKc5INNRiLipOBADnUaIBFAIAAA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org 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: Signed-off-by: Marek Szyprowski --- drivers/crypto/s5p-sss.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 1.9.2 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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); }