From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F32B0C433F5 for ; Tue, 31 May 2022 00:41:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238080AbiEaAhD (ORCPT ); Mon, 30 May 2022 20:37:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232584AbiEaAhA (ORCPT ); Mon, 30 May 2022 20:37:00 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97B56D126; Mon, 30 May 2022 17:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1653957418; x=1685493418; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=6upXiLhngd2diRhq3wzsffUdKH9r4qgqjL/Ge5fuhHI=; b=hyQhii5o4HLBCIpviOOYu+iH0l55QuoTlPuhrbh16CCVzLUe08l6negw 5WXXXdCklLQyTt31a6QjrKKhJqFNWVyPGkbsyQra1rbpRhKO8q07KGDkm 6SUW0/BTSvgcHkX9RCsoyPJGzaqdSfQ0K+zgRaqU7KRYtE6GMtff22Ix1 4=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 30 May 2022 17:36:57 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2022 17:36:57 -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; Mon, 30 May 2022 17:36:56 -0700 Received: from [10.38.244.253] (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; Mon, 30 May 2022 17:36:54 -0700 Message-ID: <68443e94-32fc-a35e-3383-0dcd8ca967c0@quicinc.com> Date: Mon, 30 May 2022 17:36:51 -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/dpu: Fix pointer dereferenced before checking Content-Language: en-US To: Haowen Bai , Rob Clark , "Dmitry Baryshkov" , Sean Paul , "David Airlie" , Daniel Vetter CC: , , , References: <1653896005-25168-1-git-send-email-baihaowen@meizu.com> From: Abhinav Kumar In-Reply-To: <1653896005-25168-1-git-send-email-baihaowen@meizu.com> 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/30/2022 12:33 AM, Haowen Bai wrote: > The ctx->hw is dereferencing before null checking, so move > it after checking. > > Signed-off-by: Haowen Bai Agree with Dmitry's comment. Adjust the patch subject to a different one otherwise PW thinks they are same patches. Reviewed-by: Abhinav Kumar > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c > index bcccce292937..e59680cdd0ce 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c > @@ -155,11 +155,13 @@ static void dpu_hw_wb_roi(struct dpu_hw_wb *ctx, struct dpu_hw_wb_cfg *wb) > static void dpu_hw_wb_setup_qos_lut(struct dpu_hw_wb *ctx, > struct dpu_hw_wb_qos_cfg *cfg) > { > - struct dpu_hw_blk_reg_map *c = &ctx->hw; > + struct dpu_hw_blk_reg_map *c; > u32 qos_ctrl = 0; > > if (!ctx || !cfg) > return; > + > + c = &ctx->hw; > > DPU_REG_WRITE(c, WB_DANGER_LUT, cfg->danger_lut); > DPU_REG_WRITE(c, WB_SAFE_LUT, cfg->safe_lut);