Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2111782pxb; Fri, 25 Mar 2022 11:17:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxbGVk03VaWs+BLyW/C4H/hekm/SvtrVlXPYzWYszyfibtcGo1Hum9FxnzaMVWzhY/ROhO X-Received: by 2002:a17:90a:3e4e:b0:1c6:586a:4d6a with SMTP id t14-20020a17090a3e4e00b001c6586a4d6amr26403874pjm.214.1648232245104; Fri, 25 Mar 2022 11:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648232245; cv=none; d=google.com; s=arc-20160816; b=dI6oIo+5wHcgxP9hgC3yeomjwjpjG9BBakxsnZP2yPGQfMGYrooxUXnMLLwdOk2oDw Z5Xcp2Jg66M6W+vKJQP7w0WlKShZbMJxbRJfWDBnTh5mHkWIC0HHQhL67GW8WkaqnCAA THqC2y0d9UrsmEFMa8etqq2eSAzS1d6X4ycx5JevGil43fgx87wHnd+Fq1lWoS4EqzTS A30vRgS1ygswvVGQaReLnn3RQnq2hBFesujoTtZhDeumX4SwtgOWajtTd0gO9e+g7qVr OZ0iKxYnMFWZQaGMGyL5yh4ThgrlQFhNWfbIqPEGDq7YEwlSn6fJGdUmoVlhXGkAehTQ rT5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=3WjmSUx8RaM4/QVWsCIY83coBlhfFkLNK0Bb6r9AgAQ=; b=GlwlC2wUcx7uMXFnzrBlO032Vk+Zso65gM2YxTaqrBBKdziVfBUYJ1mc01rLaHJNcR aVMUSAd3q4JWr/UEK/JpagZVTCFMG2JGHVgLLHSwfv7eGMfQF4huE1yHI/v+nFj39G2p s4UQVUakYA7bnvjh3UboiwQPNbw/a0ZJRQJt7pAeYysp4t4s5uTDCGfC+ItY3AFcY52x A1s1mMz6E6/OhGEW9yyjzML0cGWN1OAIayc7NKOqn00ORAbhjpeweoNPfRHcIHwJb8e3 qEdbnHTO05s42cmMi7i0QUtMb9+FogOzi4oLVYTSUoG+e8yD+KBQKJ1ZTt0tLjykJJuX 3Ceg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b="T/kbSGfd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id il5-20020a17090b164500b001bd14e03060si3647331pjb.56.2022.03.25.11.17.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 11:17:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b="T/kbSGfd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4A0131575BC; Fri, 25 Mar 2022 10:45:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347721AbiCXR55 (ORCPT + 99 others); Thu, 24 Mar 2022 13:57:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231939AbiCXR54 (ORCPT ); Thu, 24 Mar 2022 13:57:56 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D50959A5C; Thu, 24 Mar 2022 10:56:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1648144584; x=1679680584; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=3WjmSUx8RaM4/QVWsCIY83coBlhfFkLNK0Bb6r9AgAQ=; b=T/kbSGfdzOl10jQLAB3g5Pqe4qnCzpNgoj44vJOKFxAPCSm0woF+MAlQ FXeXbhxBZnwkKYJiA1JRSgcAIf/1XcW7NivgkvzKb//M4ZRgMVsoRKHeX wUCmZXdk4BTuuXjyyCV5dDj8lO9iuzweaL7v3QBhAx+0hDYxPGsCugUS6 8=; Received: from ironmsg07-lv.qualcomm.com ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 24 Mar 2022 10:56:24 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg07-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2022 10:56:24 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 24 Mar 2022 10:56:23 -0700 Received: from [10.110.52.81] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 24 Mar 2022 10:56:22 -0700 Message-ID: <0f017516-58f4-f26e-d598-4be9311e2e27@quicinc.com> Date: Thu, 24 Mar 2022 10:56:22 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH] drm/msm/disp: check the return value of kzalloc() Content-Language: en-US To: , , , , CC: , , , References: From: Abhinav Kumar In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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 On 3/24/2022 2:15 AM, xkernel.wang@foxmail.com wrote: > From: Xiaoke Wang > > kzalloc() is a memory allocation function which can return NULL when > some internal memory errors happen. So it is better to check it to > prevent potential wrong memory access. > > Signed-off-by: Xiaoke Wang Reviewed-by: Abhinav Kumar > --- > drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c > index cabe151..369e57f 100644 > --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c > +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c > @@ -169,6 +169,8 @@ void msm_disp_snapshot_add_block(struct msm_disp_state *disp_state, u32 len, > va_list va; > > new_blk = kzalloc(sizeof(struct msm_disp_state_block), GFP_KERNEL); > + if (!new_blk) > + return; > > va_start(va, fmt); >