Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3045545pxb; Mon, 18 Apr 2022 14:21:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDCyaJaFu6k28uyOWb7zNT+VfCCtFTgYo+/9Cvx2uTfqkJx2mmHhwXUg7DDXjwa8OjrJkN X-Received: by 2002:a17:90b:1e05:b0:1cd:f1ad:947c with SMTP id pg5-20020a17090b1e0500b001cdf1ad947cmr15084511pjb.214.1650316900431; Mon, 18 Apr 2022 14:21:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650316900; cv=none; d=google.com; s=arc-20160816; b=i8qXfxD6JAqwWfya2X1/pYq7un4lV42R6wrAz8+cA0Z8RTbUNzZKSHaWVu1Loa8irc Rw+ULffpZRQvHzEuKMsy6CjJvqXxxe6DDMeIA37ehdxT+MNkqfXemmdjXLpzJwYkIUQr ZQS3tqCDvRVF54QeCWX5TNDQIQdbOWGsckwIAdk+QtXL2wpQYfRwXhLBQUBxosOOKqCC sCg5TlfZ6BN6qjbjopGgjAGDKrxe3ttBEe43o72SLs9uwkk1jm/n43vxoBCnID+E+RSz whfifi44/8jyMrB8Jg5x93hsC+adMLIn2ECwkkRAaoyLy78pz3MEjZig77JrOUyRgMX7 FIXQ== 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=FjI5IFPwCzX4dj272qSjNPKomuTapZc0JnQcvdyQrAk=; b=DvyBzhwVNOmuPXM/X4xg74u4oF35Omj4Fv+QAWEMCc/D/39HckAqSd5aeJvZrZTNSh ilTXOCROibaEroWod6sDeZfG1NKrgML0mUst3ZvX607ppdfrvu5YRxRbysPbRs12EoJq QfOIOVYA+FfJeGWlmKSqviMY7xM0fvRcXURhZlA+87/M61I2cR2dskJoruichCwNqhkV LXZR061V5lNDzHyStR1jJ2vEml+zWCkmBYXDP5r8NaMLyPQKjGVVAFt13l05QqpPAqnM rGnJqGOZ2GkjTEbE84hSYfcocuv4Ots4EsHLhc0sORYOUXyMB755FJ6m8r7W9aTEuD8K 5zLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="n+1r/6zI"; 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 o22-20020a634e56000000b0039da6f076ffsi10109698pgl.67.2022.04.18.14.21.23; Mon, 18 Apr 2022 14:21:40 -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="n+1r/6zI"; 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 S244196AbiDRN41 (ORCPT + 99 others); Mon, 18 Apr 2022 09:56:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243023AbiDRN2s (ORCPT ); Mon, 18 Apr 2022 09:28:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F33DB3E5F4; Mon, 18 Apr 2022 05:53:20 -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 58EF8B80E44; Mon, 18 Apr 2022 12:53:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7189C385A1; Mon, 18 Apr 2022 12:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286398; bh=Uq4rzu+iYVCiYvKLAPyXV0+epEToMfF5Hp3/zPfFeMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n+1r/6zIB9N7GH/P45KViD7ZPZ5nFmffhsedpfOgqvtyGuzDA2L7kEuoL9Hnu52T3 4VjoPOVv3K+FCj6G//Vruac8g2VcbE+WGD4b2sZ9ON1S6f6IRzwcIWldvl7nCqTLMZ 2bYrK1DCealn0Epg+trqF+mJ/g7c5XWcj6mlK0/8= 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 4.14 085/284] memory: emif: check the pointer temp in get_device_details() Date: Mon, 18 Apr 2022 14:11:06 +0200 Message-Id: <20220418121213.102640723@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@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.7 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 ed6c5fcb136f..9f293b931144 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c @@ -1425,7 +1425,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