Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp38978rwb; Tue, 13 Dec 2022 13:45:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf4EyhMkDW5d+iIv0UVyosDOTR0Bfze5DivYHbn76Xa7dmo9klkmDOzGMAxba9fKZ4/YqBWK X-Received: by 2002:a17:902:7e88:b0:189:ced9:c9e5 with SMTP id z8-20020a1709027e8800b00189ced9c9e5mr22136458pla.13.1670967939876; Tue, 13 Dec 2022 13:45:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670967939; cv=none; d=google.com; s=arc-20160816; b=iDorMIu4Mr6ddkskLRkcofOTfDHSjYyTGDw2U6jyTTK7mfWVPlCQZAZxmM8MLegQrL jhbhk15Z2bp9UaXKIJx5kyGbaqT8/pI+GzQRj8XbhWnYfE3rOZcXw9lWY/fJBmcRWA3R RDC7KDpDNavTSjvYiN2hUBfQHI7VmQdfTXyBEd5ve0AIDDJ/+JnDV1lMJtdpzp083IMC 9A3s3ITu/vX47MQ+iiqCu3lvoTS6Tw5UQhi2eqb6aojsPArRNShwT7cvPwoTEoJdy0O4 GLe64+YPp/Os4tsEPLBJNAdRmIax0BUhZLrsDfrmTPWEwUaeYjBbLFUSasoX0t/Kwpa1 5dQQ== 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=mEJGbVQ4YAj8MitwrH5vAkyQVtyHiP0YPpO4KnP5Thg=; b=GQTCmKrOnsBKY4CQMY741BJFqF0z10ZOrOR7NKadezwzkUzCd0j9rlouMzD/tE2pQ/ p2yPez4Emmhw6gt9wdu4HHrd9DAGK/QJ50Z/D0AZfmXrYbDBdjcYA8+llBw30UXyBgZo zisAAzhYC29qAZ/uJt0QUS1+1uYmkUv2v+0usF0uv/1vH2OWK3Bsz7b6Ln2Yzeqp8/R+ JMOqD0gH+hhuSTTsN52fQYGGzaOFAQ8OSVhunkT53Hh/UCiYzxbWjVvs6sIm1cIhgTg/ jd6IlQ6OnHQtyVM7msQoNZREcp46PfTwAp6EMeYGMT71p4uG5YxdTzd6VhwTa3x4V45f 9Cvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ceM5FcYN; 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 u2-20020a170902bf4200b00186e8c3782esi753716pls.386.2022.12.13.13.45.30; Tue, 13 Dec 2022 13:45:39 -0800 (PST) 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=qcppdkim1 header.b=ceM5FcYN; 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 S236553AbiLMVhz (ORCPT + 72 others); Tue, 13 Dec 2022 16:37:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236149AbiLMVhx (ORCPT ); Tue, 13 Dec 2022 16:37:53 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A74AE096; Tue, 13 Dec 2022 13:37:51 -0800 (PST) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDJL4cK021414; Tue, 13 Dec 2022 21:37:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=mEJGbVQ4YAj8MitwrH5vAkyQVtyHiP0YPpO4KnP5Thg=; b=ceM5FcYNszAw1YE5UkIPSf0DuxcBpqO/KUXUfXPGXjbIzyEmb33sjLAY3RiRfeheuREN BfsLcdd4Ccc4EOczIQyPnSBC6DH6+eGk4SClf55lvnMtPLRYqIUunv6m4Ya0/+j0H0EK nSDFZytW6VaAVttAxwWzqGOfyHLdnRlw0wbbz51lzw+Jq/lGH6VdPK0mtggo5LR7Fyuk yvFPfu2P5o1TmDMnvcSV3418Ct62QzFEJTxw4T+ONmtFcKAiVL3YHivLVZhHr1KWvTIG JwqQonswZ1KmDQg62N3ff52Ytq23OJtqUHREjbHA6LiRR9J+KbiE1fMffjn3XbKSIh69 Uw== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3meyfkgctt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 21:37:18 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2BDLbH4b014410 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 21:37:17 GMT Received: from [10.111.167.12] (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.36; Tue, 13 Dec 2022 13:37:15 -0800 Message-ID: Date: Tue, 13 Dec 2022 13:37:13 -0800 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/dpu: Add check for pstates Content-Language: en-US To: Jiasheng Jiang , , , , , , , , CC: , , , References: <20221206080236.43687-1-jiasheng@iscas.ac.cn> From: Abhinav Kumar In-Reply-To: <20221206080236.43687-1-jiasheng@iscas.ac.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-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 1VEralEEiHfngy7W9tqwnK9KYxi7n8EW X-Proofpoint-ORIG-GUID: 1VEralEEiHfngy7W9tqwnK9KYxi7n8EW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-13_03,2022-12-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 spamscore=0 clxscore=1015 phishscore=0 adultscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212130187 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 On 12/6/2022 12:02 AM, Jiasheng Jiang wrote: > As kzalloc may fail and return NULL pointer, > it should be better to check pstates > in order to avoid the NULL pointer dereference. > > Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") > Signed-off-by: Jiasheng Jiang Once again, your lines are wrapped around too early, please use the full character limit for the commit text. With that fixed, Reviewed-by: Abhinav Kumar > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c > index 13ce321283ff..f51cb46ecfd6 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c > @@ -1150,6 +1150,8 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, > bool needs_dirtyfb = dpu_crtc_needs_dirtyfb(crtc_state); > > pstates = kzalloc(sizeof(*pstates) * DPU_STAGE_MAX * 4, GFP_KERNEL); > + if (!pstates) > + return -ENOMEM; > > if (!crtc_state->enable || !crtc_state->active) { > DRM_DEBUG_ATOMIC("crtc%d -> enable %d, active %d, skip atomic_check\n",