Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2954406imu; Mon, 19 Nov 2018 08:34:07 -0800 (PST) X-Google-Smtp-Source: AJdET5c6UqNZ9zAlwJS2UBpXBTO7SLDJnmu4OZ5JyyMfEYJoRiVdRmjMtrBJ8BbsVCQvSutbT19c X-Received: by 2002:aa7:814f:: with SMTP id d15-v6mr23960922pfn.78.1542645247545; Mon, 19 Nov 2018 08:34:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542645247; cv=none; d=google.com; s=arc-20160816; b=jc1WDc/1GL7WAxuKrXNNJh4Nk22wD/6FgwCcxKV4f/gNx77R36mRELpgf6m+bM+xNj tDJhmRN2wZPXm4Vp2TuMDpwsSChcpQIVX9ebNc1SdZ/xU1u+jzTD3BMnJZve8QRSaDCh bpwWniFv6CMlp063LoSEb4rxkeZ4Ozu5pxnoOxaQaaY1hh43WJhHpOzpEB9LDb0Nk6ar NYz1UjEXnAqO9ZS6k+4tllW/3LIDiG2mDn93QLv8gHfG+EqtqV8IjTn07uEPN/LQCZUm w5UZh8F4WUfnbFfKJwy/7ionDsuvJdeDSkaXyeXXU+aBHv8MLV+5XlUQShiJpbHN/EUX XhDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/4k2YILw1xxH1uTj0eMwXdM6DqSOtjqH8HJjGfqGCYo=; b=pbOeyz1z0W/zcvWBiLuO5xjbXV9z48Z1DueaCPaidGF8H1QTjohgMKfnkMubx5N0uo xIPHWZPkxRERwIwOz+GAi1+1VU0nFGP477O6K7WP/3HY2wSIHxRoSuOV2YbK+GFkd2oe oJi1JhMGnOHlaI/uwYnFkP/aSazg1NBunYLW4YGIK6/hLUayxLHArVRMicNpDm6lcrAL ccQaMAAngnNXHGBqJoqD2kBdSX6O5gt7Q1ZU8DL6lS3ay2EXpV/NowbjKdFwWeaChbwI vfgjwPdD7DnEG8Gkf7cRaM82+zK7/NurC0lZGTLezSwG7E4RvVg0UeTUCapNOGgX8Gix PJ3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=muI5MjiU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 207si601036pfz.249.2018.11.19.08.33.49; Mon, 19 Nov 2018 08:34:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=muI5MjiU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730305AbeKTCzM (ORCPT + 99 others); Mon, 19 Nov 2018 21:55:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:52736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730034AbeKTCzM (ORCPT ); Mon, 19 Nov 2018 21:55:12 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9E60D2086A; Mon, 19 Nov 2018 16:31:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645065; bh=nEgLqOU8AvyweRa9jgdR45mukFhEbzwbt5m/NOPLl68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=muI5MjiUCMoo6/xvpEUzknBEiXbmeSuM/yjyc2pJBttNDjxLjvdss93EwboCCTeaN i834K7JFIEfDNJpNuzF8UfMojgUHVnmewcigFknuDP9vcS8h3vxDMVNxA0ES9iPwPv OvMYhmtW1QReWrD52ghhhJ5cU00dT3lHbEwZrWKA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Su Sung Chung , Aric Cyr , Bhawanpreet Lakha , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 005/205] drm/amd/display: fix bug of accessing invalid memory Date: Mon, 19 Nov 2018 17:25:12 +0100 Message-Id: <20181119162617.904108535@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Su Sung Chung [ Upstream commit 43c3ff27a47d83d153c4adc088243ba594582bf5 ] [Why] A loop inside of build_evenly_distributed_points function that traverse through the array of points become an infinite loop when m_GammaUpdates does not get assigned to any value. [How] In DMColor, clear m_gammaIsValid bit just before writting all Zeromem for m_GammaUpdates, to prevent calling build_evenly_distributed_points before m_GammaUpdates gets assigned to some value. Signed-off-by: Su Sung Chung Reviewed-by: Aric Cyr Acked-by: Bhawanpreet Lakha Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c @@ -1069,10 +1069,14 @@ static void build_evenly_distributed_poi struct dividers dividers) { struct gamma_pixel *p = points; - struct gamma_pixel *p_last = p + numberof_points - 1; + struct gamma_pixel *p_last; uint32_t i = 0; + // This function should not gets called with 0 as a parameter + ASSERT(numberof_points > 0); + p_last = p + numberof_points - 1; + do { struct fixed31_32 value = dc_fixpt_from_fraction(i, numberof_points - 1); @@ -1083,7 +1087,7 @@ static void build_evenly_distributed_poi ++p; ++i; - } while (i != numberof_points); + } while (i < numberof_points); p->r = dc_fixpt_div(p_last->r, dividers.divider1); p->g = dc_fixpt_div(p_last->g, dividers.divider1);