Message ID | 20240216062825.165627-1-harshit.m.mogalapalli@oracle.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-68104-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp330349dyb; Thu, 15 Feb 2024 22:29:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWN8TjABaLGG0hv0L71bRkh9H+c93CmNB3TtLo3a1xL7GVqRzOQ57YKwbOTqgGQ1mc+V6tLFLYCe8mKirVtPZfE5Z1QTg== X-Google-Smtp-Source: AGHT+IGJgeFxrpMnMfp885W0Ah4c8U+6Qb9Y24QVto4lMeWv4UP6mL0rSb0NNC4O09I/OSpQGrfv X-Received: by 2002:a17:906:f2ce:b0:a3d:a774:25e0 with SMTP id gz14-20020a170906f2ce00b00a3da77425e0mr2337411ejb.18.1708064948146; Thu, 15 Feb 2024 22:29:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708064948; cv=pass; d=google.com; s=arc-20160816; b=abUJshgc7h2QMNQNT3XFoyX6hc2jy6zGXHFfVgj7/gXAvhlLcoqKIXPXQlXkT23GbK xnIKeNxqIIaQXvIS9KeX6jkd4O9+oecWN2Zgjfuf4Kp6OTi9EHPXrWVtQBlHWYTmBFM6 ueuxZ8eO/f9MMqVgzBrzQeFMIOu0OQstroUPhJ0z24cbQ0LpAyZGGCmhKQSq8JZfJ9Aq LO/51DI2lqCU4R9UTv7kamhh7cSUoBQbQ/hNy7/QwGRU5x7BqXtpKrWso3HLyppC2zyT e2NvaLMtAea2EtErdz+h9vow2EuQbHIM9NC43h02kIpLG8B/w1e4/v1J3ESlu3kcTCRY 6wqg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=11lhowEku9JauzXkE/wObrLIf2iNOyLR/O51AA5UCuY=; fh=Jr2HT1f/NoBgbb/vD0KU1BmaH2a/z6fRuITWtvzkFTA=; b=Eei/osjK+Gv47OyElvC0kxMiUMZiIgg7WMi7RP0S9lMfDp6J2+p3wkKJKVnWhtHHby 5i5fAwk7o406CnsaBx8/5PkF7ZG7zgOII9ikWAL2pItROiHWVouVZpwcvaIszaAff5+e kWgl9CGitqh1/cxPZCeADdk4c25Rd6QaeyTUUFQjd+MJAro5neMhHn+sbP99slwcE9uC QjoVrr7ak8r67P01BkwOY4qNmcVjOz/QYwjIvCuDV9/V4e3w9r/Raa3y2NoWx94/osCl froLNipwxGAP9e5lFqZrXhJ3NlocEty9GDi6OzuQDaFDuZpivqbIdXHSSvxKmLozZzr/ 5HpA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=T2N8PVS8; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-68104-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68104-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dv18-20020a170906b81200b00a3d3b7eb85asi1281570ejb.92.2024.02.15.22.29.07 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 22:29:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68104-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=T2N8PVS8; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-68104-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68104-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 984601F24007 for <ouuuleilei@gmail.com>; Fri, 16 Feb 2024 06:29:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C03614A99; Fri, 16 Feb 2024 06:28:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="T2N8PVS8" Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B755213ADC; Fri, 16 Feb 2024 06:28:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708064933; cv=none; b=N7CvBfGQwBlrou6wEJlWjrl3vw5jfvhmOWLk2tAIIJ7rAdoDiDh6Zp/kixklatq9nb0b2o/uStkVoMEaYd7I+IFQsfOgrhYdkDdSTt7454WzSKr0DcXD8hog9MxlCfP9y4zaiir55fNr2nPnbqLcn2r+bbRANHDVpbqcuMvED3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708064933; c=relaxed/simple; bh=mo8ee+GHz6jPEyUXXrNLlFXpXh64sJy2csTQ8HmKw7o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AHO6fTy5pHZMski1Qh0B3hwXKeM+HM9L9dxZamOwhes/K6lO2txxDr1/aAHS/DRuSkFIlMKlkzOTJsNguXX5dIH2/YGm3Ks5CoLutavsJqkhjV/xM/rHfhHmisG7PE/09tnuNM210mD6mb3twLBDEtz/6rfupPV4uHi5abh3uVs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=T2N8PVS8; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41G4xZru032307; Fri, 16 Feb 2024 06:28:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=11lhowEku9JauzXkE/wObrLIf2iNOyLR/O51AA5UCuY=; b=T2N8PVS86lByXQAks6rnchO2FxtwcI5Br/7b/QZMXkzC3UZT7wiOFORaIb/K3rsrLWRk zx6lHb4LDyFvLTSiPt9XBtlDpH80p4VGbHNC2wa7YX7mpnOUdWtupzrERO47lICHydus JgYCYpJ6tSPtYEzuYDOSEqp8bf91a3YWV1H1Ra3+h300GS40H8Pdsv3v57Z/Og2KlMHL EPymbvpIgpxDybp6yVOq4WhwD4zpVttTxVQwJ/aOsa/92dDmr0m9Ma+KAJdcfKXAOCXD MtGXSVdc2uGK7G+0HDUgKsxnny/hatnPFri7xe79TIeQXhkEaBNWoktZ3Zmcmc/wlLyy Dw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w91w6vduw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 06:28:33 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41G5P48i024566; Fri, 16 Feb 2024 06:28:32 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3w5ykj07sn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 06:28:32 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41G6P0w5021393; Fri, 16 Feb 2024 06:28:31 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3w5ykj07qv-1; Fri, 16 Feb 2024 06:28:31 +0000 From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> To: Harry Wentland <harry.wentland@amd.com>, Leo Li <sunpeng.li@amd.com>, Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>, Alex Deucher <alexander.deucher@amd.com>, =?utf-8?q?Christian_K=C3=B6nig?= <christian.koenig@amd.com>, "Pan, Xinhui" <Xinhui.Pan@amd.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>, Alvin Lee <alvin.lee2@amd.com>, Qingqing Zhuo <Qingqing.Zhuo@amd.com>, Wayne Lin <wayne.lin@amd.com>, Duncan Ma <duncan.ma@amd.com>, Samson Tam <samson.tam@amd.com>, "JinZe.Xu" <jinze.xu@amd.com>, Josip Pavic <Josip.Pavic@amd.com>, Cruise Hung <cruise.hung@amd.com>, Hersen Wu <hersenxs.wu@amd.com>, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, dan.carpenter@linaro.org, Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>, kernel test robot <lkp@intel.com>, Dan Carpenter <error27@gmail.com> Subject: [PATCH] drm/amd/display: fix a possible NULL dereference bug Date: Thu, 15 Feb 2024 22:28:22 -0800 Message-ID: <20240216062825.165627-1-harshit.m.mogalapalli@oracle.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-16_05,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 spamscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402160051 X-Proofpoint-ORIG-GUID: kc0_sxQHa_Md3hCzniJTwJnbPLO9kRu6 X-Proofpoint-GUID: kc0_sxQHa_Md3hCzniJTwJnbPLO9kRu6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791035910632107948 X-GMAIL-MSGID: 1791035910632107948 |
Series |
drm/amd/display: fix a possible NULL dereference bug
|
|
Commit Message
Harshit Mogalapalli
Feb. 16, 2024, 6:28 a.m. UTC
Smatch warns:
drivers/gpu/drm/amd/amdgpu/../display/dc/dc_dmub_srv.c:136
dc_dmub_srv_cmd_list_queue_execute() warn: variable dereferenced
before check 'dc_dmub_srv' (see line 131)
Fix this by moving the dereference "dc_dmub_srv->ctx" after the NULL check.
Fixes: 028bac583449 ("drm/amd/display: decouple dmcub execution to reduce lock granularity")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202311141141.GoLAPxD5-lkp@intel.com/
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
Only compile tested
---
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c index 0bc32537e2eb..a4bd46ec6da4 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c @@ -128,7 +128,7 @@ bool dc_dmub_srv_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_srv, unsigned int count, union dmub_rb_cmd *cmd_list) { - struct dc_context *dc_ctx = dc_dmub_srv->ctx; + struct dc_context *dc_ctx; struct dmub_srv *dmub; enum dmub_status status; int i; @@ -136,6 +136,7 @@ bool dc_dmub_srv_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_srv, if (!dc_dmub_srv || !dc_dmub_srv->dmub) return false; + dc_ctx = dc_dmub_srv->ctx; dmub = dc_dmub_srv->dmub; for (i = 0 ; i < count; i++) {