[Intel-gfx] [PATCH 2/5] drm/i915: WARN if the DP aux read is too big
Chris Wilson
chris at chris-wilson.co.uk
Thu Sep 12 19:15:23 CEST 2013
On Thu, Sep 12, 2013 at 01:58:18PM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni <paulo.r.zanoni at intel.com>
>
> So far we control all the reads an none of them exceeds the current
> limit of 20 bytes, but we never think about this when reviewing
> patches, so add a big WARN. In case we ever hit that WARN, we whould
> change the size of the reply array.
>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
> ---
> drivers/gpu/drm/i915/intel_dp.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 20e468c..f30b691 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -577,6 +577,8 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
>
> msg_bytes = 4;
> reply_bytes = recv_bytes + 1;
> + if (WARN_ON(reply_bytes > sizeof(reply)))
> + return -E2BIG;
Meh, this would be a programming mistake, and coule be eliminated
entirely with:
uint8_t reply[recv_bytes+1];
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list