Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1682936pxp; Thu, 17 Mar 2022 14:26:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVpSys3/vbDUybitP+IEPUzg+NvlsOT8fhx1ZN/u5PhrOXeyXZryPx3D0Uzs2f5cLC6jlm X-Received: by 2002:a17:90b:4b8a:b0:1c6:35d1:4418 with SMTP id lr10-20020a17090b4b8a00b001c635d14418mr17531947pjb.176.1647552378643; Thu, 17 Mar 2022 14:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647552378; cv=none; d=google.com; s=arc-20160816; b=I3wXF2DyG0J2TV1kseSkdXfmXo9vFJ2a/CCRBZ3ORMnMf3wjL5ohfSWaLNwdCJu6Nx rxhfjNY2rhjHLoHIZ+AN0CgPozjrDfeNMM1RVLMpet2bnTIK356vecd7QXr2eU7JbnNo X/BFxXz5USrfwqi1PTIY0HdxGEr8pZVc/l5AdJkUyYu6FIpAsLN8uzpRo0qYhceQe+jg yJ/5DGoaeRYHnqmH548EBGCOqQB5ql647erqwWnh2CRVDkZueVJunbW+sovP7QzptpUU uZZvZWZ1xKYxRsg7caSxJ9oak9SsLouusGCyXu+OI/qw7R9681bveQHcI3mqPtelTQ2b Ag0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rDd6Lum4WVHK2qnq9j8fS4muA5cEDXa7xMcM4rmC0VU=; b=aCrn2DNSymbibtxTrYa4uUD/rNlYriwSgTbhA7QhTi6YmIDN15ZaHHzGoHIj74kdZ/ SKQag58aQSHfzZrFpFD7WU/qP6/y7JYUhxrydApLjkAOkLa/v0Q6ri3J/H0cFS/JAwh9 xMrGu+vXREaW7aDiJr5aMA96c/mq+kxqn9SX7K0G3b/nQgSA5us133MhSNehCJEnqQy1 Ix6THIMfwdmwLUh1Npqo0LWSBCQfATm1MpRnuq0IBRDrRTuDHQTq9FqMPsOIR4OCKLzk z8i97cu/J94XT0bv7Cudby6DNueaXXT3jGJkdxu/CmZPKP4Jzx22jHB5tnY1e+oS/lLU PEzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=bQxQxJAo; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c8-20020aa78e08000000b004f6ecbc0876si5813778pfr.89.2022.03.17.14.26.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 14:26:18 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=bQxQxJAo; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4FE861C16CC; Thu, 17 Mar 2022 13:57:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230138AbiCQU6Q (ORCPT + 99 others); Thu, 17 Mar 2022 16:58:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbiCQU5k (ORCPT ); Thu, 17 Mar 2022 16:57:40 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0342E154078 for ; Thu, 17 Mar 2022 13:56:17 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id q7-20020a7bce87000000b00382255f4ca9so5628730wmj.2 for ; Thu, 17 Mar 2022 13:56:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rDd6Lum4WVHK2qnq9j8fS4muA5cEDXa7xMcM4rmC0VU=; b=bQxQxJAopjBa0cH3DEA/wH7NmBNJs68v3ttaUHN/+kGRSs6CQsIpqCvzQQN2lyiZa5 O9dMEpnnsSy4JfQpypICumZkQ/hfGH9OX3mg4mdQbuAAS0E+BjA+6mbMnUOanIeTVNmP KHpuqC9s2au36N2guRPz4Q5RluOow2CMFqhnPmaCuhE69JVLbrCaxtYcqg5q18QeuJ4s MaK6NCzRLP/CRb74vXmwyBHCN6mQc44u7+4d8P8rU+iSIduD1scckg/ESB2SFEJ1GVSN WwuAdMYz6HZJhzuD/xRei98D5eYjbgGxlPMNoCoQkBKCfdZvip7YoM0SD4XpebERtwpg eu1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rDd6Lum4WVHK2qnq9j8fS4muA5cEDXa7xMcM4rmC0VU=; b=iEev7IXLgQZkN2SdI9j/V6qJjHHCHNvvoeI3+b2DqqenksclaN/lbqykWrwUuatXpz K4uSWHKSgWOubyLXH1Wojuk95uh5tmpoiUB7n4GRLjmYatrucYfV7pMjmMg5ZHNbXKOc wjNonOuDHV1NTPWeWNERQJCbEoE6cGl5Gv2w8mCFIZAzFBkbsvATosBs3m48rB+GyeFD 3prtLP4/84to4AbXdVsbSTlRc02xT9wYsr7yQZHY0Nr0EogwwpsMsTKh2f391F0+4x50 mnvPb2PiTna9bVccybu0IIHrMX37RM4SsEjMxOCC3npEW+YSMjpkr84WBzbNmEYamxxX UoTA== X-Gm-Message-State: AOAM531aNGVRAZHBBop/NhPQCJh8hBdWN1GNuyfpzQsPhVKhbw30fTl7 QxCTmpivMgsmPYFTgNP/3b//Iw== X-Received: by 2002:a05:600c:4e07:b0:38c:8187:13c3 with SMTP id b7-20020a05600c4e0700b0038c818713c3mr3010470wmq.11.1647550576305; Thu, 17 Mar 2022 13:56:16 -0700 (PDT) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id r4-20020a05600c35c400b00389f368cf1esm3695424wmq.40.2022.03.17.13.56.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 13:56:16 -0700 (PDT) From: Corentin Labbe To: herbert@gondor.apana.org.au, jernej.skrabec@gmail.com, samuel@sholland.org, wens@csie.org Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev, Corentin Labbe Subject: [PATCH 07/19] crypto: sun8i-ss: test error before assigning Date: Thu, 17 Mar 2022 20:55:53 +0000 Message-Id: <20220317205605.3924836-8-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220317205605.3924836-1-clabbe@baylibre.com> References: <20220317205605.3924836-1-clabbe@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The first thing we should do after dma_map_single() is to test the result. Signed-off-by: Corentin Labbe --- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c index eaa0bbaf5581..49e2e947b36b 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c @@ -420,15 +420,15 @@ int sun8i_ss_hash_run(struct crypto_engine *engine, void *breq) } addr_pad = dma_map_single(ss->dev, pad, j * 4, DMA_TO_DEVICE); - rctx->t_src[i].addr = addr_pad; - rctx->t_src[i].len = j; - rctx->t_dst[i].addr = addr_res; - rctx->t_dst[i].len = digestsize / 4; if (dma_mapping_error(ss->dev, addr_pad)) { dev_err(ss->dev, "DMA error on padding SG\n"); err = -EINVAL; goto theend; } + rctx->t_src[i].addr = addr_pad; + rctx->t_src[i].len = j; + rctx->t_dst[i].addr = addr_res; + rctx->t_dst[i].len = digestsize / 4; err = sun8i_ss_run_hash_task(ss, rctx, crypto_tfm_alg_name(areq->base.tfm)); -- 2.34.1