Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp627489rdg; Wed, 11 Oct 2023 00:11:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGn5C9Mi7+kmjuyHdcpLbUnYaOe9gHbzrZMwHpEuMBLeBMCq0f/AMQrtE0lqmeIe4j15Dkz X-Received: by 2002:a05:6870:348e:b0:1d5:a58d:1317 with SMTP id n14-20020a056870348e00b001d5a58d1317mr22917503oah.10.1697008267871; Wed, 11 Oct 2023 00:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697008267; cv=none; d=google.com; s=arc-20160816; b=un6LDu3TbXoPWRXfvvMh5LFATWkT9IWnJx+ZGcMLQoe36Nh0RY7cFPcHymqHGSbL3L CCDY841SDdrkH5p56IHuJRZv/8prorQVkDLNiFhrtxcP/7QynIBWvkWmDOZFAaxQ2qZ9 dw32SfZef0m/mmitoTlgqPCLVgzqPYr82PUJeFoCado3apfFwG/fCBoouIQXgqJXK674 n04ZaIkLtFGpYCkHmCKjTGIuHvuBfwPKlOybmZIalDWj438QOTK3GYemKocAZgM/nW17 j7zvuC5EJ9XTnBJ0SW2oEBtwYmAsUh8mowZb8C1tMggpCuRWz8YHKA7T7NV3T3iFDP+a Ovyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from:dkim-signature; bh=LMuevU+3F423kvl+oEGa4v6wuA/hhhSQFrJEHcrk+3s=; fh=xIMMsVZuYegSmyvZ0vXKEAN3Dal8A20kSjJ8N9ahCq0=; b=QU7XSjWjdUGGPwbjVGnTjJ6dIEAt/9bcJAE2/vj4Nqniefx/7n9YbTViAqs1wVVWSx lraqzdcwhuQszl/zBI/g6pUV2NCe/V9j2ZvsZhttXEyjCAsFJJ765xR/yv/lNPk5Ot1H FyIp2uvHuzdN6f+0ldr2oPhOJYpo3WsqnXRMMEpxWv7xOmED5HkqlYqqiMjYH/kmWLFe 9pYxW/rEOffvAnncOYunD+dn09DjleI7TBQVUEJk4KNvJsnVqhSwQDM9u3rFsU3c/Q1C ChtfsBggTQH9kmoHu2/sfI3eSKxlBzmquXdtq5XdZsHt+VFeTOAUqGmxycC1IBft0slF 2DXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bOhGOa7Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id 17-20020a630111000000b00578d460cd7esi11879756pgb.431.2023.10.11.00.11.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 00:11:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bOhGOa7Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 308C880CC212; Wed, 11 Oct 2023 00:11:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344494AbjJKHKz (ORCPT + 99 others); Wed, 11 Oct 2023 03:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343997AbjJKHKy (ORCPT ); Wed, 11 Oct 2023 03:10:54 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 692EA90 for ; Wed, 11 Oct 2023 00:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697008253; x=1728544253; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=Ml7Fp7eHHGupyYR1HlJpyyVZB1D65axD2PsS0w1/tPc=; b=bOhGOa7Y9z+3ff/Ogzmb32U+UOcjVFsnNgHfoSRIrpZOmCUMqFm+MPIz bxx4W01Sya/WhUYzAm6TRLxWrXi1u3qNLiVbg88DcTRfMM+z1nRDatEfA HFewSHCHFTlOMyU3XkaiSdITqJkNjJUH8dtgQYmcAcvU5VIfhvykWP788 GcGvHC5VBO/fhePEkSYUF/pibKZzkrFNcotm5yNx46SE6ERcJm64MWTgX 67cqgO46grUu9If1sUcbdJfxXNdxJYB8LxVHxBZRbpb3Of3TLGPJdroTO QRy3eEOXYpPzzpcwWG5qT+SjemesSl88st6BnFlaVCd6UdSF4Dymeb5wv A==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="451090801" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="451090801" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 00:10:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="824057686" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="824057686" Received: from wprelogx-mobl.ger.corp.intel.com (HELO localhost) ([10.252.56.229]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 00:10:32 -0700 From: Jani Nikula To: Ma Ke , maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Ma Ke Subject: Re: [PATCH] drm/edid: fix a possible null pointer dereference In-Reply-To: <20231011013316.4091845-1-make_ruc2021@163.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20231011013316.4091845-1-make_ruc2021@163.com> Date: Wed, 11 Oct 2023 10:10:30 +0300 Message-ID: <874jix63dl.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=2.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 11 Oct 2023 00:11:04 -0700 (PDT) X-Spam-Level: ** On Wed, 11 Oct 2023, Ma Ke wrote: > In drm_mode_std(), the return value of drm_gtf_mode(), > drm_gtf_mode() and drm_cvt_mode() is assigned to mode, > which will lead to a NULL pointer dereference on failure > of drm_gtf_mode(), drm_gtf_mode() and drm_cvt_mode(). > Add a check to avoid null point dereference. > > Signed-off-by: Ma Ke > --- > drivers/gpu/drm/drm_edid.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 340da8257b51..e2c154c2b896 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -3381,6 +3381,8 @@ static struct drm_display_mode *drm_mode_std(struct drm_connector *connector, > false); > break; > } > + if (!mode) > + return NULL; This doesn't change anything. BR, Jani. > return mode; > } -- Jani Nikula, Intel