diff mbox series

drm: xlnx: zynqmp: fix a memset in zynqmp_dp_train()

Message ID YGLwCBMotnrKZu6P@mwanda (mailing list archive)
State New, archived
Headers show
Series drm: xlnx: zynqmp: fix a memset in zynqmp_dp_train() | expand

Commit Message

Dan Carpenter March 30, 2021, 9:31 a.m. UTC
The dp->train_set[] for this driver is only two characters, not four so
this memsets too much.  Fortunately, this ends up corrupting a struct
hole and not anything important.

Fixes: d76271d22694 ("drm: xlnx: DRM/KMS driver for Xilinx ZynqMP DisplayPort Subsystem")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/gpu/drm/xlnx/zynqmp_dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michal Simek April 7, 2021, 10:17 a.m. UTC | #1
On 3/30/21 11:31 AM, Dan Carpenter wrote:
> The dp->train_set[] for this driver is only two characters, not four so
> this memsets too much.  Fortunately, this ends up corrupting a struct
> hole and not anything important.
> 
> Fixes: d76271d22694 ("drm: xlnx: DRM/KMS driver for Xilinx ZynqMP DisplayPort Subsystem")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/gpu/drm/xlnx/zynqmp_dp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c
> index 99158ee67d02..59d1fb017da0 100644
> --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c
> +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c
> @@ -866,7 +866,7 @@ static int zynqmp_dp_train(struct zynqmp_dp *dp)
>  		return ret;
>  
>  	zynqmp_dp_write(dp, ZYNQMP_DP_SCRAMBLING_DISABLE, 1);
> -	memset(dp->train_set, 0, 4);
> +	memset(dp->train_set, 0, sizeof(dp->train_set));
>  	ret = zynqmp_dp_link_train_cr(dp);
>  	if (ret)
>  		return ret;
> 

Reviewed-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal
Daniel Vetter April 8, 2021, 10:53 a.m. UTC | #2
On Wed, Apr 07, 2021 at 12:17:49PM +0200, Michal Simek wrote:
> 
> 
> On 3/30/21 11:31 AM, Dan Carpenter wrote:
> > The dp->train_set[] for this driver is only two characters, not four so
> > this memsets too much.  Fortunately, this ends up corrupting a struct
> > hole and not anything important.
> > 
> > Fixes: d76271d22694 ("drm: xlnx: DRM/KMS driver for Xilinx ZynqMP DisplayPort Subsystem")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> >  drivers/gpu/drm/xlnx/zynqmp_dp.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c
> > index 99158ee67d02..59d1fb017da0 100644
> > --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c
> > +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c
> > @@ -866,7 +866,7 @@ static int zynqmp_dp_train(struct zynqmp_dp *dp)
> >  		return ret;
> >  
> >  	zynqmp_dp_write(dp, ZYNQMP_DP_SCRAMBLING_DISABLE, 1);
> > -	memset(dp->train_set, 0, 4);
> > +	memset(dp->train_set, 0, sizeof(dp->train_set));
> >  	ret = zynqmp_dp_link_train_cr(dp);
> >  	if (ret)
> >  		return ret;
> > 
> 
> Reviewed-by: Michal Simek <michal.simek@xilinx.com>

Stuffed into drm-misc-next, thanks.
-Daniel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c
index 99158ee67d02..59d1fb017da0 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_dp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c
@@ -866,7 +866,7 @@  static int zynqmp_dp_train(struct zynqmp_dp *dp)
 		return ret;
 
 	zynqmp_dp_write(dp, ZYNQMP_DP_SCRAMBLING_DISABLE, 1);
-	memset(dp->train_set, 0, 4);
+	memset(dp->train_set, 0, sizeof(dp->train_set));
 	ret = zynqmp_dp_link_train_cr(dp);
 	if (ret)
 		return ret;