Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp673123pxb; Tue, 5 Apr 2022 18:12:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyob/uzAMbsQdmdm8fjs0XdRnuEJJbXPR4G2qzgyq6O+kdCzMp+jX21LDiFihcTvWRSLaqf X-Received: by 2002:a05:6402:c9b:b0:41c:c215:2cce with SMTP id cm27-20020a0564020c9b00b0041cc2152ccemr6340838edb.388.1649207429300; Tue, 05 Apr 2022 18:10:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649207429; cv=none; d=google.com; s=arc-20160816; b=t8THel7vaf+iPTguM4hlqqfLVKmjnzsqqnVxgDbZi27z5N+8YDhUjGi4I8l0/cNjro 8x2pYNJLIgIW8TkPfbkBfbtksOpPbq2pdpV8muAsb89hQqGIXevFFpd7OE02dLmgdW99 mUf5KaEfoKGROplIiVSTOm4MMEBtmvF3iITJ0Ma15uPATWlpGAbTBF0wlfyDU0pltBmM epp03F1fT18sIhDySnnQIBBi03C8zP0rdbsoBTUdW9uyy9Sml+nS2Xd7/Hh3hCSoWypn Tb+Y8q0oF1iUPQ+bP8c+0MZT+beK6x/7kQyYye/+ju29TFVyKlO2banIO/nCRr2/QJTA EqWQ== 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=liPrx1REbfMicgdj9xPOffYeXIm5k3y8ks2+2twLWNQ=; b=uXNOevpRDgSDGYUO2yiUF2/HGfqTddVXwVxeh0A0VPXxZfAywyRYuLg9cuBc8Pm9fx ezoF4csFxUgGxsNRr5adG3zEarSwqkvu1fP6FVk6I2k6qaaEKbKXaaqOfeJMGJ/SFmPO sj8KSAS1rLFaiVJJct7Qjo4Jd6QmfUFeSriUgPj8yc4JHD0AQRF/35UfSp9j/26BKNxg LaOjbPLLm8sCWD+JdDXWBucRDS3qpWAtAMluHrRTrsjePNp9xmCe0cSaDeq/dBO9F/XB Uwb43SZBg/sx3USG0N/Z+Qs6JMt5QVl29KSH7pqZoFKNlIQENtzod9zkpc4TEGWYyxm6 J0og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KAfDeu2R; 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 w22-20020a170906d21600b006df76385bb6si10587863ejz.86.2022.04.05.18.10.04; Tue, 05 Apr 2022 18:10:29 -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=KAfDeu2R; 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 S239714AbiDEIUf (ORCPT + 99 others); Tue, 5 Apr 2022 04:20:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235726AbiDEIAM (ORCPT ); Tue, 5 Apr 2022 04:00:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 203041EAD8; Tue, 5 Apr 2022 00:58: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 dfw.source.kernel.org (Postfix) with ESMTPS id B123361722; Tue, 5 Apr 2022 07:58:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF269C340EE; Tue, 5 Apr 2022 07:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649145493; bh=Qc5JUQdNaG632zqHws9pZ7Yz8zs6uc92MCr5DjfyIrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KAfDeu2RlJN4PiqCVyNpKMZEjkCafS6BZNEFVSNUgSaQy8Qx/7T9f/F5St8GqjAdn 8oVcYdaFpfyOJYxMVM8yYNK133J6OuLzuhOLWVqGK/eOidSWIRc1QDhBg8JeyrWILZ YE6Jz/XPhviZbOCM3XximbJn4UjPWMnPWPo6vkYk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jia-Ju Bai , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.17 0387/1126] memory: emif: check the pointer temp in get_device_details() Date: Tue, 5 Apr 2022 09:18:54 +0200 Message-Id: <20220405070418.986472750@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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,T_SCC_BODY_TEXT_LINE 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: Jia-Ju Bai [ Upstream commit 5b5ab1bfa1898c6d52936a57c25c5ceba2cb2f87 ] The pointer temp is allocated by devm_kzalloc(), so it should be checked for error handling. Fixes: 7ec944538dde ("memory: emif: add basic infrastructure for EMIF driver") Signed-off-by: Jia-Ju Bai Link: https://lore.kernel.org/r/20220225132552.27894-1-baijiaju1990@gmail.com Signed-off-by: Krzysztof Kozlowski Signed-off-by: Sasha Levin --- drivers/memory/emif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index d4d4044e05b3..ecc78d6f89ed 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c @@ -1025,7 +1025,7 @@ static struct emif_data *__init_or_module get_device_details( temp = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); dev_info = devm_kzalloc(dev, sizeof(*dev_info), GFP_KERNEL); - if (!emif || !pd || !dev_info) { + if (!emif || !temp || !dev_info) { dev_err(dev, "%s:%d: allocation error\n", __func__, __LINE__); goto error; } -- 2.34.1