Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2319859pxb; Mon, 20 Sep 2021 18:43:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPkIFM6MgEX8IlQ5fQv9df8sxFeG3a0Ad71pR1WtXejt9IJzQ9Ehyf4fJ22aZUVCBWJ01+ X-Received: by 2002:a5e:a904:: with SMTP id c4mr1707473iod.14.1632188598710; Mon, 20 Sep 2021 18:43:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188598; cv=none; d=google.com; s=arc-20160816; b=PCrcwYYDCDewcBPzXLX+Fh2VXWfGsGIzsDhB5gEhFkyG+BiskpCAYJgSPJUWyZwtv0 tF8ZUPMpRteRDPljdYDd5I9X66OzRKN1Ar7uJeGM4wLqxCCjkhTU6qFlwZ+5LmaNJZna +s7LLs0/STMXFcTvEik3OcFRi+u7vQU0K7pYIUbDEp57NZ6f83+DKfzxqAWs6s4e0wYC an2/Odv/wrCOXrTodwwZz31sG4c4pGgvBzq+gfFW1I2IWwJ+UkAjn+FVpzAbdLvPmYD3 FAczFcGb3oRfyiof5oazeKZJOgXLdyxdRlVjzGZFgGdy4GQAPZbcrBlavzRX3Rk/xTNR XWaA== 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=h0jkGp9Sd6AVMjkJ9bgWH66XCQzKk7HmGUTFb/ySkEo=; b=hCj4rVU1EG7brJhNZ8yPsa2YbVJf1BFiC+jkQJv5VjIbSXEPPAraM/u2P91cmfcipj 3sSIdYeiVrrI5qN6Khh5taIJK66ZMvqFk9rUZi43HqOoc74sSyX5Rw8gccXM1z86t2a6 jH/p1R+SwvXaHvhE0MP/VEhkKEBTZg5jlTANH3wBRDu6nqLI3WjTCdlmb0HjRYsOCqmi rrLiqE+c1O2y/qUP4pfXyXF9TlyRVnXIfN+BZvj1RzPsz/UwnY1UI2lJfp77q71LB8LO PtRwe7oU0i6QfwC32wzuxTG7oZXZvzyQlgnhVcbcniTWiMKp3yfn58N13n/ZLxGSkeKt FOVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uVsgpT4r; 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 13si16757018jan.43.2021.09.20.18.43.07; Mon, 20 Sep 2021 18:43:18 -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=uVsgpT4r; 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 S234497AbhITQyB (ORCPT + 99 others); Mon, 20 Sep 2021 12:54:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:39768 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244500AbhITQu0 (ORCPT ); Mon, 20 Sep 2021 12:50:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B96F16127B; Mon, 20 Sep 2021 16:48:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632156539; bh=7bFbsGkqnveGerGt8Uvc6MaWqVEX3Q4HJMbFzdXQtGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uVsgpT4r/BDA/ZBw1hxlkAd4xYi8/A6qrYwVXy20JdqlFZvSwuqOJNL+bswRijttE xz1tez5m1KbTqB3l381NULl6BoDXFM/JsyGr+zDbBLpwZJY73fNyTT9DADOfiMB1f+ piKdpaiO9rHDNikanJIzhPJi16jexnBx2qylSWG8= 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 4.4 106/133] gpu: drm: amd: amdgpu: amdgpu_i2c: fix possible uninitialized-variable access in amdgpu_i2c_router_select_ddc_port() Date: Mon, 20 Sep 2021 18:43:04 +0200 Message-Id: <20210920163916.094605655@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163912.603434365@linuxfoundation.org> References: <20210920163912.603434365@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 31a676376d73..3490d300bed2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c @@ -340,7 +340,7 @@ static void amdgpu_i2c_put_byte(struct amdgpu_i2c_chan *i2c_bus, void amdgpu_i2c_router_select_ddc_port(struct amdgpu_connector *amdgpu_connector) { - u8 val; + u8 val = 0; if (!amdgpu_connector->router.ddc_valid) return; -- 2.30.2