Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1702774pxb; Thu, 16 Sep 2021 13:24:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeqd+FhwHMXGs2j9ZaAKfMqwMTGT39ycM8bEhNRLyQV9lhz81L1Ax8wtOIUT+FBSUCQcQO X-Received: by 2002:a05:6e02:1cad:: with SMTP id x13mr5284397ill.60.1631823879116; Thu, 16 Sep 2021 13:24:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631823879; cv=none; d=google.com; s=arc-20160816; b=VbyjnH1c4YR93BYg6FD91VTqsbx1rnP/2+5yljz0C6/ifCgZr3nUeIt1HLx7YBfCBv vHbwMPraTZd3hlldMS2eMFDYePew47rr1ym2pBGMaziyVFRbnJaEUdVXIJtNGByOXU1p pZTSCdZOGmQ+fXwhPU5bx0o/7dhZx5lC18Lh5PMPB+d+VYol5XMEFObTcjjwMDNY6vty 6uUCzyau/WWDfS9Zhf5SfpUAYuXpreAGbRdqRSK+UGR7NpoL20vhPk5OnEFYiTdtMEg3 4PKOtKV1XeSEZ66vQIzrhzhLfiJgnsNUbK/C78xSLxBNOJKpTs5G6xk5MgO1EYovTb1N 9jEA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EbCrbzPUDRAdswA4VDEDiOK8yoPxafpJa5IQ9zafqMk=; b=rKfcPsiROn9boikdcuokPmv/DMc2IGoTYWNz0n80B8RnyererrjBLkIKuRLEsW0BQp trbvOMpMsmkQkYJyPqHstjIRW990wfRr4TSp5vIwCeuQqPohmcKGaAtIOXlmuPG84zVZ h045GUxn79Z56kPtnIAZCUTfdq9VOkW2CSGnamf/ar9sgjgQ1k9MYQRBNw6uK9INEBvs ffNLTsXCd7s2E10GH+wlUxgI+uZuHhbPST8VsS8xGDZqX/dJTfRfBc/+zJeLvuaMQIrW 3DBWMmf/A0NvwexoTapzFkANdry1AhrzZFnz9LlmiOXoB9l7alEhwnW4LIBpZvWIlEHt rmyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kIohiz8b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n7si4395917ili.27.2021.09.16.13.24.26; Thu, 16 Sep 2021 13:24:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kIohiz8b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242152AbhIPQ0n (ORCPT + 99 others); Thu, 16 Sep 2021 12:26:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:55070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241223AbhIPQTU (ORCPT ); Thu, 16 Sep 2021 12:19:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D518C6138E; Thu, 16 Sep 2021 16:13:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808804; bh=rPW4weNS1rJgczyBsbBFdNp7YgrJ3bWcPLZVVztza48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kIohiz8bjMbkxB08mugHYazPQ2EORTuyISPnIi9898HFrVbvIm8bYOg92B0r8Gtke okcK1iE6cPmUfzoCWh5kwMrUUrYkVW5d4F6HQb5vc+aag6sUBrmIUB7fCjfUkDcAHD wOX5U1vAwtnkX5CCKAN9iZj/QN9suiFBNjLmNaiY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, TOTE Robot , Tuo Li , Alex Deucher , Sasha Levin Subject: [PATCH 5.10 211/306] gpu: drm: amd: amdgpu: amdgpu_i2c: fix possible uninitialized-variable access in amdgpu_i2c_router_select_ddc_port() Date: Thu, 16 Sep 2021 17:59:16 +0200 Message-Id: <20210916155801.237742815@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tuo Li [ Upstream commit a211260c34cfadc6068fece8c9e99e0fe1e2a2b6 ] The variable val is declared without initialization, and its address is passed to amdgpu_i2c_get_byte(). In this function, the value of val is accessed in: DRM_DEBUG("i2c 0x%02x 0x%02x read failed\n", addr, *val); Also, when amdgpu_i2c_get_byte() returns, val may remain uninitialized, but it is accessed in: val &= ~amdgpu_connector->router.ddc_mux_control_pin; To fix this possible uninitialized-variable access, initialize val to 0 in amdgpu_i2c_router_select_ddc_port(). Reported-by: TOTE Robot Signed-off-by: Tuo Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c index 47cad23a6b9e..b91d3d29b410 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c @@ -339,7 +339,7 @@ static void amdgpu_i2c_put_byte(struct amdgpu_i2c_chan *i2c_bus, void amdgpu_i2c_router_select_ddc_port(const struct amdgpu_connector *amdgpu_connector) { - u8 val; + u8 val = 0; if (!amdgpu_connector->router.ddc_valid) return; -- 2.30.2