lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 13 Oct 2016 15:13:11 +0300
From:   Jani Nikula <jani.nikula@...ux.intel.com>
To:     wharms@....de, Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Daniel Vetter <daniel.vetter@...el.com>,
        Ville Syrjälä <ville.syrjala@...ux.intel.com>,
        David Airlie <airlied@...ux.ie>,
        intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
        drm-intel-fixes@...ts.freedesktop.org
Subject: Re: [patch] drm/i915: fix a read size argument

On Thu, 13 Oct 2016, walter harms <wharms@....de> wrote:
> Am 13.10.2016 10:55, schrieb Dan Carpenter:
>> 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 <dan.carpenter@...cle.com>

Dan, good catch, thank you. Luckily we only really use the first byte
currently...

Cc: <drm-intel-fixes@...ts.freedesktop.org>

>> 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))
>
>
>
> perhaps we can morph that into something more readable ? I would suggest:
>
>
> if (intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE)
>   {
>     size_t size=sizeof(intel_dp->edp_dpcd); /* == EDP_DISPLAY_CTL_CAP_SIZE */
>     int ret;	
>
>     ret=drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,intel_dp->edp_dpcd,size);	
>
>     if (ret != size )
>         ......
>
>  }
>
> this way it improves readability and reduces line length.

Not convinced, let's just take the simple brace fix now.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ