[Intel-gfx] [PATCH] drm/i915: Warn about aux msg buffer vs. size mismatch

Ville Syrjälä ville.syrjala at linux.intel.com
Tue Aug 2 13:41:13 UTC 2016


On Thu, Jul 28, 2016 at 10:15:35PM +0200, Daniel Vetter wrote:
> On Thu, Jul 28, 2016 at 05:55:04PM +0300, ville.syrjala at linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > 
> > If we have have a buffer, we should also have a size, and vice versa.
> > Let's check it both ways instead of just one.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

Pushed to dinq. Thanks for the review.

> > ---
> >  drivers/gpu/drm/i915/intel_dp.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index 21b04c3eda41..001f74fc0ce5 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -1041,10 +1041,10 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
> >  		if (WARN_ON(txsize > 20))
> >  			return -E2BIG;
> >  
> > +		WARN_ON(!msg->buffer != !msg->size);
> > +
> >  		if (msg->buffer)
> >  			memcpy(txbuf + HEADER_SIZE, msg->buffer, msg->size);
> > -		else
> > -			WARN_ON(msg->size);
> >  
> >  		ret = intel_dp_aux_ch(intel_dp, txbuf, txsize, rxbuf, rxsize);
> >  		if (ret > 0) {
> > -- 
> > 2.7.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Ville Syrjälä
Intel OTC


More information about the Intel-gfx mailing list