linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] matroxfb: fix size of memcpy
@ 2016-08-25 17:56 Sudip Mukherjee
  2016-09-27  8:45 ` Tomi Valkeinen
  0 siblings, 1 reply; 2+ messages in thread
From: Sudip Mukherjee @ 2016-08-25 17:56 UTC (permalink / raw)
  To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen
  Cc: linux-kernel, linux-fbdev, Sudip Mukherjee

hw->DACreg has a size of 80 bytes and MGADACbpp32 has 21. So when
memcpy copies MGADACbpp32 to hw->DACreg it copies 80 bytes but
only 21 bytes are valid.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
 drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/matrox/matroxfb_Ti3026.c b/drivers/video/fbdev/matrox/matroxfb_Ti3026.c
index 195ad7c..68fa037 100644
--- a/drivers/video/fbdev/matrox/matroxfb_Ti3026.c
+++ b/drivers/video/fbdev/matrox/matroxfb_Ti3026.c
@@ -372,7 +372,7 @@ static int Ti3026_init(struct matrox_fb_info *minfo, struct my_timming *m)
 
 	DBG(__func__)
 
-	memcpy(hw->DACreg, MGADACbpp32, sizeof(hw->DACreg));
+	memcpy(hw->DACreg, MGADACbpp32, sizeof(MGADACbpp32));
 	switch (minfo->fbcon.var.bits_per_pixel) {
 		case 4:	hw->DACreg[POS3026_XLATCHCTRL] = TVP3026_XLATCHCTRL_16_1;	/* or _8_1, they are same */
 			hw->DACreg[POS3026_XTRUECOLORCTRL] = TVP3026_XTRUECOLORCTRL_PSEUDOCOLOR;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] matroxfb: fix size of memcpy
  2016-08-25 17:56 [PATCH] matroxfb: fix size of memcpy Sudip Mukherjee
@ 2016-09-27  8:45 ` Tomi Valkeinen
  0 siblings, 0 replies; 2+ messages in thread
From: Tomi Valkeinen @ 2016-09-27  8:45 UTC (permalink / raw)
  To: Sudip Mukherjee, Jean-Christophe Plagniol-Villard
  Cc: linux-kernel, linux-fbdev


[-- Attachment #1.1: Type: text/plain, Size: 1159 bytes --]

On 25/08/16 20:44, Sudip Mukherjee wrote:
> hw->DACreg has a size of 80 bytes and MGADACbpp32 has 21. So when
> memcpy copies MGADACbpp32 to hw->DACreg it copies 80 bytes but
> only 21 bytes are valid.
> 
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
>  drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/matrox/matroxfb_Ti3026.c b/drivers/video/fbdev/matrox/matroxfb_Ti3026.c
> index 195ad7c..68fa037 100644
> --- a/drivers/video/fbdev/matrox/matroxfb_Ti3026.c
> +++ b/drivers/video/fbdev/matrox/matroxfb_Ti3026.c
> @@ -372,7 +372,7 @@ static int Ti3026_init(struct matrox_fb_info *minfo, struct my_timming *m)
>  
>  	DBG(__func__)
>  
> -	memcpy(hw->DACreg, MGADACbpp32, sizeof(hw->DACreg));
> +	memcpy(hw->DACreg, MGADACbpp32, sizeof(MGADACbpp32));
>  	switch (minfo->fbcon.var.bits_per_pixel) {
>  		case 4:	hw->DACreg[POS3026_XLATCHCTRL] = TVP3026_XLATCHCTRL_16_1;	/* or _8_1, they are same */
>  			hw->DACreg[POS3026_XTRUECOLORCTRL] = TVP3026_XTRUECOLORCTRL_PSEUDOCOLOR;
> 

Thanks, queued for 4.9.

 Tomi


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-27  8:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-25 17:56 [PATCH] matroxfb: fix size of memcpy Sudip Mukherjee
2016-09-27  8:45 ` Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).