Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2412143pxb; Sun, 30 Jan 2022 15:41:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXIfh62i6aC52ieFl4bO8guC44z1Ga/xB1rjtyg6mCGfRN/kmNYbHgHzkxSKo0YHPDl9xn X-Received: by 2002:a05:6402:35c5:: with SMTP id z5mr15443098edc.43.1643586102895; Sun, 30 Jan 2022 15:41:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643586102; cv=none; d=google.com; s=arc-20160816; b=nGPa3z6/q6hQdK5j+KbtZGVlKIS/sWrhvZqWj6Saz6D4Bb5338XZsPETYkvzJLg9DC Vb4XvXoUduKmJUhQCHKAkL48+UatCXHbjM5znToZXayREX9TCc7d10OxARblzV4wrwBn F5dGfyaDWZPeV1MwWvNEHje+sNSQ9G/f43zFNbzaltGuoHK13Q9KnZ5aaxrcPFAo61B/ omtRAb4rWt0QEq7Jd91gJmFLDSBY6beHdMl30EBTx7JhFueIdkF5FUeOwQhhYgVQWKwg eZgSld5BTOSWEXF0NxmzlJSWGUSituw/KH3da1XOkKJb2hVo46HvFznXkO+yTee1GHuQ it+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dKOiYARh91ON6Q3vHH7juSW1zLMr76hRlgcpyYL88j8=; b=eWU+unADIzkxKZfnEyLVeNUllwDodIYzIQm/CEV/NqQ5tdsdP9wlFBvXQS7xfZ5Jkb zEc+D4SZW3Dn1lwoy9xVVh8iwXocdFxOvo3ar5IMOOu5ObIVmxpo7Lr6gD20YMOGsp18 XMUgj8J0/n6MaxBK915lA+mmPXYPNtX73+olGifxxXSFCBz2UAD/KiwvP/DWjDtldzr5 7JNFs8I34mnyJc012d6in9OYwVTi/DVTTJz5OqaU++hcgdA5EQjik5TzYHyZTLxAJAlW 8fO+OOyyhquUr2vVGhf3t9aqwxcmP0Qai4ynPjcgctQjQWlD19uLKbwILKTwq75FHVUY 3Dqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qA460ZBg; 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 f16si8289276edd.414.2022.01.30.15.41.18; Sun, 30 Jan 2022 15:41:42 -0800 (PST) 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=qA460ZBg; 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 S1347793AbiA1KSI (ORCPT + 99 others); Fri, 28 Jan 2022 05:18:08 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:39578 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347787AbiA1KRw (ORCPT ); Fri, 28 Jan 2022 05:17:52 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D6E88B8250F for ; Fri, 28 Jan 2022 10:17:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0B43C340E0; Fri, 28 Jan 2022 10:17:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643365069; bh=SHk7nsLZVBmrkzHaZ93gwIMjnBT1dr7eQOTPySNEeNY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qA460ZBgv/rmRN3I7hCrX4M19ZMSUXuy18zfqE5oMnTvRI0GSUPyb5rqr1U0g+UHc g8/rHG4dnuH8GTUtqoqhQxV8r6BgzXQ6Xm72g4ucdFskh+06vAY2ihaBW7gNxoQL0Z NAWRgT1aTxRB5pMi0e3dYfpG9tU+Nq/cLApeq2TE= Date: Fri, 28 Jan 2022 11:17:41 +0100 From: Greg KH To: Zhou Qingyang Cc: kjlu@umn.edu, Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Lee Jones , Mario Kleiner , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/amd/display/dc/calcs/dce_calcs: Fix a memleak in calculate_bandwidth() Message-ID: References: <20220124165552.56106-1-zhou1615@umn.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220124165552.56106-1-zhou1615@umn.edu> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 25, 2022 at 12:55:51AM +0800, Zhou Qingyang wrote: > In calculate_bandwidth(), the tag free_sclk and free_yclk are reversed, > which could lead to a memory leak of yclk. > > Fix this bug by changing the location of free_sclk and free_yclk. > > This bug was found by a static analyzer. > > Builds with 'make allyesconfig' show no new warnings, > and our static analyzer no longer warns about this code. > > Fixes: 2be8989d0fc2 ("drm/amd/display/dc/calcs/dce_calcs: Move some large variables from the stack to the heap") > Signed-off-by: Zhou Qingyang > --- > The analysis employs differential checking to identify inconsistent > security operations (e.g., checks or kfrees) between two code paths > and confirms that the inconsistent operations are not recovered in the > current function or the callers, so they constitute bugs. > > Note that, as a bug found by static analysis, it can be a false > positive or hard to trigger. Multiple researchers have cross-reviewed > the bug. > > drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c > index ff5bb152ef49..e6ef36de0825 100644 > --- a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c > +++ b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c > @@ -2033,10 +2033,10 @@ static void calculate_bandwidth( > kfree(surface_type); > free_tiling_mode: > kfree(tiling_mode); > -free_yclk: > - kfree(yclk); > free_sclk: > kfree(sclk); > +free_yclk: > + kfree(yclk); > } > > /******************************************************************************* > -- > 2.25.1 > As stated before, umn.edu is still not allowed to contribute to the Linux kernel. Please work with your administration to resolve this issue.