From patchwork Sun Feb 18 22:16:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kilian Zinnecker X-Patchwork-Id: 202882 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp971302dyc; Sun, 18 Feb 2024 14:17:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVmlMP1ObWYd1TooCMr+vstLr797rvaFnbZVhFGwuvRP7/tmidW2goE+uH5Q3loehgv+JT8Lc3vtf9h+BDW50ugvF1PWw== X-Google-Smtp-Source: AGHT+IHY26T5AeAWqX69rch2mb1R+p6QIejDiZSmRS7DQayRg6w7ByPO4b8vJqw3el99yvqUDCIb X-Received: by 2002:a05:6a21:2d8e:b0:19c:8d73:721b with SMTP id ty14-20020a056a212d8e00b0019c8d73721bmr15193952pzb.57.1708294679592; Sun, 18 Feb 2024 14:17:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708294679; cv=pass; d=google.com; s=arc-20160816; b=edt2wDgU+0M6N/Lfima73t5SibMr+0rzp81itJZeaCUCNP0SKyqIicpj7Pm4+yQp0e ojDQYpaqbaNdDKxEmEzvv7pZRm1NuygV0B91E/pvcyN4M0LyN6Gro3CEQv/WxXuyBLAd plKZjlArBQVbgUaA7S6yeZTV2Odw4oLTkO2kEimGipVhgfGcIa9p2Gnmaad+Jx3hg05p uR0FklJ2CTz1d5SuGUWymOwBa6swWegPxkqIeONP2HLyisSBkRFEduYXZZYP1eIpQHeA FNE/B4biWVApiemrp4+tvmKxUSLWyLD1kFlE1gpAtEnYPLvR+74N+h3UadBcYRJYov/g OzFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=lW7p0hQiRBNtIcMVqgaoD80WNo7/AZ/clfhklcokU98=; fh=dTVNR5RU85PBEeIym0Qqfu5BZZn9Qu3wYQwQV7o7b2g=; b=CpTAHZqpix6KgJTM6rk5MwzQvFFP0QnSFUjllorlFI9H39d5XoKYr7w92YoTKrUNKJ l5uaT+FgWuRbnZYR6kgt5t3BTznlvqcYaqbWN5HsSDjsQthnDMQmuL409UlpkoHQE5ec p7FJDp5be1LhMl6XKiWjVKXmbYGlKNjOnSDk2bLvbmkGJPqDGjdZtiX+dbHSP0abcgeS OfcLnz7liwVNLMT3ha+Y6COhfEHN9LnEUi1Pk04eTWVJ7f6jXQ94aIngQD5YSSZuAR32 Y0uPBzZ45y95l4cuNq9k7lFxVtdWyxzyERA1Q2z4XrW6NsCZ9+g9haVZjFaRI72D0hmi X4Bw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mail.de header.s=mailde202009 header.b=b0Oz+t44; arc=pass (i=1 spf=pass spfdomain=mail.de dkim=pass dkdomain=mail.de dmarc=pass fromdomain=mail.de); spf=pass (google.com: domain of linux-kernel+bounces-70604-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70604-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mail.de Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b24-20020a639318000000b005dc4a7c2325si3313213pge.824.2024.02.18.14.17.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 14:17:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70604-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@mail.de header.s=mailde202009 header.b=b0Oz+t44; arc=pass (i=1 spf=pass spfdomain=mail.de dkim=pass dkdomain=mail.de dmarc=pass fromdomain=mail.de); spf=pass (google.com: domain of linux-kernel+bounces-70604-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70604-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mail.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6C1CB28177E for ; Sun, 18 Feb 2024 22:17:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FF30745E0; Sun, 18 Feb 2024 22:17:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mail.de header.i=@mail.de header.b="b0Oz+t44" Received: from shout02.mail.de (shout02.mail.de [62.201.172.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D9E66F07C; Sun, 18 Feb 2024 22:17:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.201.172.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708294662; cv=none; b=b4M9nXMYSfpFcuXFoLQg5WQSDakEKSCwsXkYMwTXqqA6mmcG425iND8K4yxiX6cozseo+LXt9gpRQlbkSOazjbCBFntyFpgLnkI8NKYXYYROY0HgSElb6KAxyOlKECjqaawhYnpteuJFV4aXoaAX7QM2bWmvALrQg/nQb78NhSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708294662; c=relaxed/simple; bh=N3H39/B4i2sFZWcEBwc/gNTosE/eDkGZGZvxmMONy6s=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=WWHXINPzmG+rBkK8Z1k62nharQZ5rOPR+pge6oHN/ORflkmjt+oyceX4g19bfm/PkcQLs/YKtTkCDd8LLuwruaSpuUfpJ+R38zHaFJ3LPG8niHYgTAj26jWXKrLu8XpIJfXE96UkWoqXqpnCBD1bwUojRo3TJNcTCiIbJjh6GvA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mail.de; spf=pass smtp.mailfrom=mail.de; dkim=pass (2048-bit key) header.d=mail.de header.i=@mail.de header.b=b0Oz+t44; arc=none smtp.client-ip=62.201.172.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mail.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mail.de Received: from postfix01.mail.de (postfix01.bt.mail.de [10.0.121.125]) by shout02.mail.de (Postfix) with ESMTP id CA911240D76; Sun, 18 Feb 2024 23:17:22 +0100 (CET) Received: from smtp01.mail.de (smtp01.bt.mail.de [10.0.121.211]) by postfix01.mail.de (Postfix) with ESMTP id ABD9480145; Sun, 18 Feb 2024 23:17:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mailde202009; t=1708294642; bh=N3H39/B4i2sFZWcEBwc/gNTosE/eDkGZGZvxmMONy6s=; h=From:To:Cc:Subject:Date:Message-Id:From:To:CC:Subject:Reply-To; b=b0Oz+t444Iy/mMVCQexZJsa1Ia2Us0mQOjygXNPbAUtL0T1Vnku6T40CJffkGJaGz 6OgqXvUed2qmuU38ESaV/Eu8UQcWJQzWpZl2f5b2Y2vQERbpDRyH6NRCYu9BJRaldy l+4T4zSOoujJARpo1FOeXKakoqmTGPOP2W4Kc7qAAVvaLjK/RuET9y6Dos2bd/vMth tnXH3FBckSIBKs3ayyn8TyJKdzeMtLFW0L1OdtbRgpTxeme1sfQ9H8hAp3mDZj3geU kctTBYYaFUE6h1C2oz2mOKssrpPbNDkJix5hylwE8LGHKxIN6oZPm0ETupwO2ZdlHT xO9NEBDI2i3iw== Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp01.mail.de (Postfix) with ESMTPSA id 23479240550; Sun, 18 Feb 2024 23:17:04 +0100 (CET) From: Kilian Zinnecker To: Corentin Labbe , Herbert Xu , "David S . Miller" , Heiko Stuebner Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Kilian Zinnecker Subject: [PATCH] crypto: rockchip - fix to check return value Date: Sun, 18 Feb 2024 23:16:58 +0100 Message-Id: <20240218221658.131043-1-kilian.zinnecker@mail.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 1095 X-purgate-ID: 154282::1708294642-065BF670-B0B11907/0/0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791276802032670148 X-GMAIL-MSGID: 1791276802032670148 crypto_engine_alloc_init may fail, e.g., as result of a fail of devm_kzalloc or kthread_create_worker. Other drivers (e.g., amlogic-gxl-core.c, aspeed-acry.c, aspeed-hace.c, jr.c, etc.) check crypto_engine_alloc_init's return value and return -ENOMEM in case a NULL pointer is returned. This patch inserts a corresponding return value check to rk3288_crypto.c. Signed-off-by: Kilian Zinnecker --- drivers/crypto/rockchip/rk3288_crypto.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/crypto/rockchip/rk3288_crypto.c b/drivers/crypto/rockchip/rk3288_crypto.c index 70edf40bc523..f74b3c81ba6d 100644 --- a/drivers/crypto/rockchip/rk3288_crypto.c +++ b/drivers/crypto/rockchip/rk3288_crypto.c @@ -371,6 +371,11 @@ static int rk_crypto_probe(struct platform_device *pdev) } crypto_info->engine = crypto_engine_alloc_init(&pdev->dev, true); + if (!crypto_info->engine) { + err = -ENOMEM; + goto err_crypto; + } + crypto_engine_start(crypto_info->engine); init_completion(&crypto_info->complete);