Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1488981pxb; Wed, 30 Mar 2022 04:54:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoJTjaBxZ1mB1zDhYSkwGC3L984dUqV+zYHyERxvbzAL58aD/7Dr3PJeDvcN7tdVLLMB6n X-Received: by 2002:aa7:c345:0:b0:419:12ae:449c with SMTP id j5-20020aa7c345000000b0041912ae449cmr10105016edr.300.1648641271943; Wed, 30 Mar 2022 04:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648641271; cv=none; d=google.com; s=arc-20160816; b=NLy+NAx87T/2u1AnP7bpCSqOPoG4iWp/pQYmbK2VXt/K4A44w+KAuqjcDPQzlEznrj PVfPSt/DVHDorrLULWZWHF/h8vGV241kvUZjrKOuPuqjBh5MTHplo0UbNsEDFZ3di394 oAHo3mlm3mLeBGqBhLbWFhuUPpDzaTnlpdtSXXjtkjpJaAtMsEeNtzxClb2LrHDIFeO8 awVR4mc6mw8S1KQA837QlD6hRKJEfxTCHrqf//L9DVkIwramvusZd0sJKooZcBu5r2SD 74Ys/qlc5ZRLAoZMUv+Cg/HLe1hKaOGCgQ7HSVwhhyjvkKlCDyu7/ChTEfmocii600re oBXg== 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=QOPFOuJOfba4L+FeuEz1NdlNEPoVm4AUyXGmKyFlUQQ=; b=MbNKogqSkx328WiYtxMua+MJ7tPn+KVitlwO3Xvi3OORBGOiNOhX6iFpRIAjqqGFei vs3ulIGzJF9TPvz7hssLlU0zbsgiOuROi5xBSrv0WNQq60nD4zi8ed1Sze8bQV5tcUBA GEbnHN3VBVwQVBVWntjc2IiUj3OYP0vHq1jHZY/I8Hk2JyjwTepW7mnMcnU3BfiXoGPw AHB2+5bvg5PjQoothOm+naY3+7f+O3rj5bryA4ijD7fpuP7j1xmRusFysjV7JP1NQKU5 bpUF149GhdM5DGKefRO92n++yfL+66UWTexjNbuGQ65fnc9xEO4kZhr95hZP3eN0ODvH ZpCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=Rv5GxrjR; 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=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y29-20020a50ce1d000000b00419075664c3si18051506edi.273.2022.03.30.04.54.03; Wed, 30 Mar 2022 04:54:31 -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=@quicinc.com header.s=qcdkim header.b=Rv5GxrjR; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232754AbiC2U5T (ORCPT + 99 others); Tue, 29 Mar 2022 16:57:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232750AbiC2U5R (ORCPT ); Tue, 29 Mar 2022 16:57:17 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4C4DB2441; Tue, 29 Mar 2022 13:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1648587332; x=1680123332; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=QOPFOuJOfba4L+FeuEz1NdlNEPoVm4AUyXGmKyFlUQQ=; b=Rv5GxrjRVWbQR6ZwZrpR26LvZ+g9psjK9ZYg44/7Jx3X0ju25pwI02mq DJX5jLaGpiXUi7Zk2fNdKRkRGbjLU4IrG/x+OIMKBKRdtjXxqlvUaU3lk ePouzxTaxwRNW2YOS/l9rwxmZ6lTJiPvDgXrEcBc9iB50xR8d4X8KbPa9 8=; Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 29 Mar 2022 13:55:30 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2022 13:55:29 -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; Tue, 29 Mar 2022 13:55:28 -0700 Received: from [10.110.122.15] (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; Tue, 29 Mar 2022 13:55:27 -0700 Message-ID: Date: Tue, 29 Mar 2022 13:55:27 -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: add null pointer check Content-Language: en-US To: , CC: , , , , , , , , , , , Zeal Robot References: <20220329103416.2376616-1-lv.ruyi@zte.com.cn> From: Abhinav Kumar In-Reply-To: <20220329103416.2376616-1-lv.ruyi@zte.com.cn> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, 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 Seems to be a duplicate of https://patchwork.freedesktop.org/patch/479378/ Thanks Abhinav On 3/29/2022 3:34 AM, cgel.zte@gmail.com wrote: > From: Lv Ruyi > > kzalloc is a memory allocation function which can return NULL when some > internal memory errors happen. Add null pointer check to avoid > dereferencing null pointer. > > Reported-by: Zeal Robot > Signed-off-by: Lv Ruyi > --- > 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 5d2ff6791058..acfe1b31e079 100644 > --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c > +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c > @@ -176,6 +176,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); >