From patchwork Mon Oct 24 11:30:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430846wru; Mon, 24 Oct 2022 05:42:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42MDiJvFoQ1KTTlI6izI1DFTzuHfq1flKSa3t81jrsc5uq1+70jvSBhZuyJhhUxGjSG9BV X-Received: by 2002:a05:6a00:2384:b0:566:813c:ae24 with SMTP id f4-20020a056a00238400b00566813cae24mr33479424pfc.17.1666615341903; Mon, 24 Oct 2022 05:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615341; cv=none; d=google.com; s=arc-20160816; b=hW09caENw+gPfR/rnj9G7ErbDOoZnOYwHrAH1Psx3Zl3u2/KQt/vvnvo+acij2BbrD 4TplO7Z+HnaMG9yg/pZ8URuorjr3O/+8AjXC7htN6r/C0bJWUwSso+9uA84PeVbypkBa Q1ErB+rl8cKxuLpR9S0DvGsd80fGhLzNNv2/cdROGg4wPMRR8xPXOd/80gOdllhwg8cy 1oFGwQo8Kz4oOtYmyu+igxatzkAjiVSHx9drMOPehn9LwRVB5KeS4akqQAfJOFa7NOGT 3ZjDMutGNL7b4FkcISeb/Up06vimaH8LGQWVc+uUWseazGYzmJNze2Yt8aK37cd74lqH jjAA== 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=m8CdF+PSqne2g0vOr1XeYxn5qAZpb6QvwlFGHmjXf6E=; b=Us55htioi7WkBNdQcY0heDq6IQSyR5p03XtnD7cG2RUDSbtLdtrQrKjZJhTR07Fr4Z k6WJ1Y8Ds/Ynysaa2EQSkJwvX+aeS/EZv7amLmB2lKSEo9qnfnd+zgSyKAH+TDZdUCXU u6/pSDC+mvu1NfnRdHfYB3zwdpzLDTutUZ9Y9/NsacrnfvIBZxqVNFg+F5uJ3MoFHApg fiKfqdtuDnSmpAGiC/B8rwgW4dqxbP6NrXfJyMfqYwb79VqNuKXWP35UypsH7NSdS0NN pp1g2a+dtVt3LGiJq9zRhi2tVT7C9Ailk/+iXbCObFttaEKZI5YaUs7aVLlWs/sqZXdU KiPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dBUqyZfS; 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 h15-20020a056a00218f00b005698856bb2bsi15771144pfi.330.2022.10.24.05.42.07; Mon, 24 Oct 2022 05:42:21 -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=dBUqyZfS; 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 S234104AbiJXMd5 (ORCPT + 99 others); Mon, 24 Oct 2022 08:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234142AbiJXM3Y (ORCPT ); Mon, 24 Oct 2022 08:29:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9E1C88A0D; Mon, 24 Oct 2022 05:03:14 -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 ams.source.kernel.org (Postfix) with ESMTPS id E4AB3B81200; Mon, 24 Oct 2022 12:00:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42895C433C1; Mon, 24 Oct 2022 12:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612830; bh=4/5oQa4SXwqMtAcGf0F3+o2IZAhzz6PX17NqEpDjG/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dBUqyZfSgKekWNwR+0O0nbePo7jjdY6hsCxUVurVHoB78roTA9xrKKHp4X+0Zugeg e8V0nIs0M+oILFC/0aSsyXpGTb4/f/5b7OG/2Ty/Ahzwe22cl3g/AwAPoTfSQZgGBF HWo1YFNJv7tMPiSVxXmsY/ny8urEuHhtqoJPmdZY= 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 4.19 135/229] mtd: devices: docg3: check the return value of devm_ioremap() in the probe Date: Mon, 24 Oct 2022 13:30:54 +0200 Message-Id: <20221024113003.372004673@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747572848563384472?= X-GMAIL-MSGID: =?utf-8?q?1747572848563384472?= 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 512bd4c2eec0..740a09c9f67a 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -1990,9 +1990,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)