Received: by 2002:a05:622a:251a:b0:39a:b4a2:e86 with SMTP id cm26csp316368qtb; Wed, 19 Oct 2022 02:43:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ueQ4TYPUmYCCg3l2etGX6NEnliHAqSIgxiFShCRdDscMPorqyQzMga7F+GCEs4amgWucz X-Received: by 2002:a63:e14c:0:b0:439:2e24:e014 with SMTP id h12-20020a63e14c000000b004392e24e014mr6335975pgk.173.1666172606404; Wed, 19 Oct 2022 02:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172606; cv=none; d=google.com; s=arc-20160816; b=qydPeEaNdiMiHK299WfuZr8Q5mjS9+YPJW5UjC3vGQQNjPLCBycQ4VzSpzRiBlsZKe Ne+11kqMiQy5bieSWEWHdKnQLBcFpbMFJggF8umZbpfZK4OJU3XYzJ6vQS3rLk+9iocy NMvwh3sVEN8DE2adas16oZ4kpIpJGy0CY4qLU0LBN4DyaZfx4kmMVS4nz/zL5lIR9Q6f e/3dBC+0YniuI417/IohR4y4k+aGakhoKGbMeB5ghKeK4TUoSa4V+YztD5kwD1DsBu6H kg/iToYxWyqjmpYyLJEhtB+mJnMU+yEz/z9KBCPkThZ3tJ1ZS5I4mBs/wL9QwDGLHR6u mVEg== 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 Return-Path: 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.43.13; Wed, 19 Oct 2022 02:43:26 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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) -- 2.35.1