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: 8935471 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DEE55BF29F for ; Tue, 26 Apr 2016 07:29:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E959020114 for ; Tue, 26 Apr 2016 07:29:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F5EA20172 for ; Tue, 26 Apr 2016 07:29:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752322AbcDZH3u (ORCPT ); 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-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Krzysztof Kozlowski Acked-by: Vladimir Zapolskiy --- 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); }