Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10089989rwr; Fri, 12 May 2023 03:47:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7W34Jzbp9BfiOB0mMN0LvtswI1UiRFHtM3R33dtaLbUEQmyr1pvr5i08qF3xTLyD0XQH2g X-Received: by 2002:a05:6a00:1f10:b0:63f:32ed:92b1 with SMTP id be16-20020a056a001f1000b0063f32ed92b1mr30345987pfb.7.1683888420322; Fri, 12 May 2023 03:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683888420; cv=none; d=google.com; s=arc-20160816; b=RXSo95t4hjg7QBWmJFSMwh9z2doaA6wFYcnJW4jjMKMx4DvBmcH/sTbp8y4LkJTvdV M4FpAUrEQPSRf3+s5V7b1VrA7Pnk3VmymPw9pso4H3jrHMWinE5Qn6WFj7rLqaK++aOG 7RtqD3svTQ77h2hS142zc1Er4UmrCGBClJtROdB/1LtraqTz8roGP+0/9JYZ9s2Zm4au Y5qC/DCo7wW+72HVXTs+T+bU1QlyiYBXNYlfeW/Wl2UO21p766B63QGrVoUquRSrABYW FK+HDWcnpOqWNV/c9UqOPT3GOuXVwABZuiZsm0Lt/EIRwpcfULOeQqjKzJcH12b2v9zw 9kkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=u4+NrGrBWcxQk9YZPtAXUarmmkMQVkEOUnIC6lzQpyI=; b=xqX2RqufD6xihrfKu4Rq0epiAvWLqbbXAcNlR8qUn6OGsusSjW+zTasekYybvFOmRF B8gM8RWsXhI9lFxlGE73S/MzxyurF1JmZbVM9TPk7WVOtuJRfJIqb3j42ifUZClBDu4Q 7xgZVAajTucvONErsXfaAUm+UlYFk8JnRBnGe3q5u+KXLljUY04iXLW5nu1+XosZnA1B 5F9RVOlEAl/r9gFFcHgXClym4XMVfNzbyk1HO1ls9UzN7lDzBKV5hdP/xAYB1v7j96Wf Vk057YWwT7nvI0mELX/O2Ei4ps4oYasWtcoOE1TnN2Fff0XAs4NtrbAD6MvPBobgcwuu x2JQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 123-20020a620481000000b00627dd2b5307si9585986pfe.102.2023.05.12.03.46.46; Fri, 12 May 2023 03:47:00 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240546AbjELKeO (ORCPT + 99 others); Fri, 12 May 2023 06:34:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240523AbjELKeH (ORCPT ); Fri, 12 May 2023 06:34:07 -0400 Received: from exchange.fintech.ru (e10edge.fintech.ru [195.54.195.159]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F1972D72 for ; Fri, 12 May 2023 03:33:25 -0700 (PDT) Received: from Ex16-01.fintech.ru (10.0.10.18) by exchange.fintech.ru (195.54.195.169) with Microsoft SMTP Server (TLS) id 14.3.498.0; Fri, 12 May 2023 13:33:22 +0300 Received: from KANASHIN1.fintech.ru (10.0.253.125) by Ex16-01.fintech.ru (10.0.10.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Fri, 12 May 2023 13:33:22 +0300 From: Natalia Petrova To: Ben Skeggs CC: Natalia Petrova , Karol Herbst , Lyude Paul , David Airlie , Daniel Vetter , , , , Subject: [PATCH] nouveau_connector: add nv_encoder pointer check for NULL Date: Fri, 12 May 2023 13:33:20 +0300 Message-ID: <20230512103320.82234-1-n.petrova@fintech.ru> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.0.253.125] X-ClientProxiedBy: Ex16-02.fintech.ru (10.0.10.19) To Ex16-01.fintech.ru (10.0.10.18) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 Pointer nv_encoder could be dereferenced at nouveau_connector.c in case it's equal to NULL by jumping to goto label. This patch adds a NULL-check to avoid it. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 3195c5f9784a ("drm/nouveau: set encoder for lvds") Signed-off-by: Natalia Petrova --- drivers/gpu/drm/nouveau/nouveau_connector.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 43a9d1e1cf71..90ba6d0a9c80 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -729,7 +729,8 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force) #endif nouveau_connector_set_edid(nv_connector, edid); - nouveau_connector_set_encoder(connector, nv_encoder); + if (nv_encoder) + nouveau_connector_set_encoder(connector, nv_encoder); return status; } -- 2.34.1