From patchwork Wed Oct 19 08:30:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4876 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225358wrs; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IclH9L1TFMfUg2bm4DH/2RaaKzjrADUlRqJak91hpH7gcKc/bTIaubcokA2WVqt0xc7FJ X-Received: by 2002:a17:902:e0d1:b0:182:6ab:98e3 with SMTP id e17-20020a170902e0d100b0018206ab98e3mr7583852pla.5.1666172578401; Wed, 19 Oct 2022 02:42:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172578; cv=none; d=google.com; s=arc-20160816; b=ClBLLRJvoTyqVgoebzIpwUTMkjOFa+sNduI6HJkXzX7De+YbMj0bcB4piCCI1eDHJy uFfLyNEeOLc2EKSpJ7JAjwA4lgeJPBfkQ/yCJLb3YTSBC7juHfwg01SvU+aJO1fdA/fB I1Y3eBqajK0HgqKMpGFaeCRbG7A/Aoh7jTxNTmMTRxlIR6X58NpF4HNH1zQ93PrT0sgL 9q8836OmUPvmmLfli9nfl+5QPYh+91UaOkd/heiYUO2IYY5x30vTBfI1xkItT13XVbZM p/NBDlx5M+2rFuKOZarzBnUIKDi5ltvSntKYiztIqs72NqdH2Gt8Hm4ZancpU9eDK2cn R8/Q== 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=wmzfKQ6o1KGcayCu/luUzTvgtxWxNSFrMCnHnBnZPbKd05U32hmkaNKUDyJgA0VKzf vBTLGjkqoeBD9N0Yj56luEytMKNP1GikTvzsHu+GAH7rnXgY608uc6NpuN7IAiTS6U87 ax5zMeil3CJQEr85He4ZqCvAWx6SxIQq55XwwOI+aGC5N3/1xvnZTOEKhOnePjBzwyAY XB/jnYGp7WAOOSbMz8TD7mH6gGu1RUsNA291bcjp5xS9+C0X2/nfP2CjJoOVx2PiTmss xok36ZupNb0GFqSjLhGeW35UNVtw3BIrNB5Snq0ykZ+FX897/BmH7DTQz7F76Gbcv5Mq iyrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fttDkwpu; 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 x185-20020a6386c2000000b0043961d07372si16356143pgd.585.2022.10.19.02.42.45; Wed, 19 Oct 2022 02:42:58 -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=fttDkwpu; 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 S231143AbiJSJdO (ORCPT + 99 others); Wed, 19 Oct 2022 05:33:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233699AbiJSJ3H (ORCPT ); Wed, 19 Oct 2022 05:29:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D47FEA37E; Wed, 19 Oct 2022 02:12: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 4DD92617F7; Wed, 19 Oct 2022 09:01:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CE1EC433D6; Wed, 19 Oct 2022 09:01:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170101; bh=d4xHh/EUCkCOVmUiHgDNQoi2lFnlAt1QKWLdSYAR6Ls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fttDkwpuNtykFY3q1TEAKKW4de/YNEP9wt/5JlUalFG8TbZf5IjT4dbClvmHXFayw RnVLuhkyIOW9GWAHQQbYxEqJepbRf5J+1H8bWyzqd/f+Sx9zvNVfkSwNounKSwujTI voIg0R+2CnEzIDDXzWSlL/o4qX2CJsyhBQSS1iIA= 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 6.0 520/862] mtd: devices: docg3: check the return value of devm_ioremap() in the probe Date: Wed, 19 Oct 2022 10:30:07 +0200 Message-Id: <20221019083312.961891298@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747108577751327963?= X-GMAIL-MSGID: =?utf-8?q?1747108577751327963?= 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)