From patchwork Sat Oct 22 07:25:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121024wrr; Sat, 22 Oct 2022 02:27:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7tx7t91KZQcTClRTnTtv+5av7QdcRO5/l0++2jGa0ZbEfXH1eI+4nUHd2tfMlI5Ck8afSM X-Received: by 2002:a17:903:234f:b0:17f:6711:1f9f with SMTP id c15-20020a170903234f00b0017f67111f9fmr22639378plh.32.1666430835978; Sat, 22 Oct 2022 02:27:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430835; cv=none; d=google.com; s=arc-20160816; b=OyWZBqZwJAStsH19nZSTCnL5ht55a7OO/FLL3HdVWE3mrBUWBSAkrYcPmq+HAVigJp PxENAxf3538cdp1JEAN3VS72vyrOxq2u9ev5yCfaNf05HDV4c71eMZPvc2sRoMtR96CA 9+1GXOF2cbB+cNco9B2TdRNR6fJi4YiCJO3v7eRlJvFDsVib7v/KaSm7sq8OKknP6XJQ PnxM0UkNH14HZM9dp3GE+LsqIkS6gf3LeI1FnvBBksrVsFb/qHEpaBLaEndgC7neUrsQ rW1/bH15UUNpLORZRKzuAEhjFIVwJRZW64q1GixgJ7ZrulCdUv7syRb2TyuDFakuHCcy k4lw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WjoXa8Zt14lxad46j760H2XqKZUIdxZYDgFPK+9gOJ0=; b=uGr+ByWuZrZ1ZPFd4Ikhdvdtj3H1/pHyRnhaJY/m60O4F9Xyxd/jt9FGKgK8PCy4ds MquqA2zDSgEndLC+ffRCYhT3+nFJxcjwEbaMy0RWZoT8XPw3jzdSN7I5iZE6nirpw+RN zWOzt2VWpnl4BfBI4lii/ZjX/8xTPaYMfSUqACYnHCEwdTYuD+fkPS+pjUzkdkNOnRhz u4rwMYbHeER5x9FI/fgcLmCBHoGNZYHTsgKFBEfo1FI4396g2E5OXRTRs5ZlXGRDabmb /aqnl/GFwLt3eXPVtRYZpaCploYI7iX436L/SQeE0qTj2d3jIwKJPAuTaI3Cwg12iDJc cofw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hOjJVgEf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me8-20020a17090b17c800b001fd7cab081bsi2756247pjb.125.2022.10.22.02.27.03; Sat, 22 Oct 2022 02:27:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hOjJVgEf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbiJVJFL (ORCPT + 99 others); Sat, 22 Oct 2022 05:05:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235091AbiJVJDo (ORCPT ); Sat, 22 Oct 2022 05:03:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C70DA2FA5CC; Sat, 22 Oct 2022 01:18:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3FF7760B89; Sat, 22 Oct 2022 07:55:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52F31C4314C; Sat, 22 Oct 2022 07:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425320; bh=d4xHh/EUCkCOVmUiHgDNQoi2lFnlAt1QKWLdSYAR6Ls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hOjJVgEfrCMMqjzeoHIvcXTA1aW8xUgqnn7Cl50jmtEc3/tmWpaeAel2BxrRMCIdU b7zRulekcm5mHEwdbTNNjEzPnqObb6WqwsxxDeqsLx9vN0PzkrhzXaBXhcLtCFzZe3 ozJYmWTj6smB3oil7MqQ/y8StrSmxRO8KYnOnqyI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , William Dean , Miquel Raynal , Sasha Levin Subject: [PATCH 5.19 422/717] mtd: devices: docg3: check the return value of devm_ioremap() in the probe Date: Sat, 22 Oct 2022 09:25:01 +0200 Message-Id: <20221022072517.050464932@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747379380256924877?= X-GMAIL-MSGID: =?utf-8?q?1747379380256924877?= From: William Dean [ Upstream commit 26e784433e6c65735cd6d93a8db52531970d9a60 ] The function devm_ioremap() in docg3_probe() can fail, so its return value should be checked. Fixes: 82402aeb8c81e ("mtd: docg3: Use devm_*() functions") Reported-by: Hacash Robot Signed-off-by: William Dean Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220722091644.2937953-1-williamsukatube@163.com Signed-off-by: Sasha Levin --- drivers/mtd/devices/docg3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c index 5b0ae5ddad74..27c08f22dec8 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -1974,9 +1974,14 @@ static int __init docg3_probe(struct platform_device *pdev) dev_err(dev, "No I/O memory resource defined\n"); return ret; } - base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); ret = -ENOMEM; + base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); + if (!base) { + dev_err(dev, "devm_ioremap dev failed\n"); + return ret; + } + cascade = devm_kcalloc(dev, DOC_MAX_NBFLOORS, sizeof(*cascade), GFP_KERNEL); if (!cascade)