Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753124AbcJMJHu (ORCPT ); Thu, 13 Oct 2016 05:07:50 -0400 Received: from mailapp02.imgtec.com ([217.156.133.132]:24244 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752554AbcJMJHl (ORCPT ); Thu, 13 Oct 2016 05:07:41 -0400 Date: Thu, 13 Oct 2016 10:07:22 +0100 From: Eric Engestrom To: Dan Carpenter CC: Daniel Vetter , Ville =?utf-8?B?U3lyasOkbMOk?= , , , , Subject: Re: [patch] drm/i915: fix a read size argument Message-ID: <20161013090722.GI1743@imgtec.com> References: <20161013085508.GJ16198@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <20161013085508.GJ16198@mwanda> User-Agent: Mutt/1.7.1 (2016-10-04) X-Originating-IP: [10.60.4.28] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1401 Lines: 32 On Thu, Oct 13, 2016 at 11:55:08AM +0300, Dan Carpenter wrote: > We want to read 3 bytes here, but because the parenthesis are in the > wrong place we instead read: > > sizeof(intel_dp->edp_dpcd) == sizeof(intel_dp->edp_dpcd) > > which is one byte. > > Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP") > Signed-off-by: Dan Carpenter Good catch! What tool did you use to find it, or did you find it by inspection? Reviewed-by: Eric Engestrom (btw, there's a missing `---` here, between the commit msg and the diff) > > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > index 14a3cf0..ee8aa95 100644 > --- a/drivers/gpu/drm/i915/intel_dp.c > +++ b/drivers/gpu/drm/i915/intel_dp.c > @@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp) > /* Read the eDP Display control capabilities registers */ > if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) && > drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV, > - intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) == > - sizeof(intel_dp->edp_dpcd))) > + intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) == > + sizeof(intel_dp->edp_dpcd)) > DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd), > intel_dp->edp_dpcd);