All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fbdev: remove unnecessary memset in vfb
@ 2015-06-18 13:01 ` Marcin Chojnacki
  0 siblings, 0 replies; 8+ messages in thread
From: Marcin Chojnacki @ 2015-06-18 13:01 UTC (permalink / raw)
  To: plagnioj; +Cc: tomi.valkeinen, linux-fbdev, linux-kernel, Marcin Chojnacki

In vfb_probe memory is allocated using rvmalloc which automatically
sets the allocated memory to zero. This patch removes the second
unnecessary memset in vfb_probe.

Signed-off-by: Marcin Chojnacki <marcinch7@gmail.com>
---
 drivers/video/fbdev/vfb.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/video/fbdev/vfb.c b/drivers/video/fbdev/vfb.c
index 70a897b..b2d38b7 100644
--- a/drivers/video/fbdev/vfb.c
+++ b/drivers/video/fbdev/vfb.c
@@ -490,14 +490,6 @@ static int vfb_probe(struct platform_device *dev)
 	if (!(videomemory = rvmalloc(videomemorysize)))
 		return retval;
 
-	/*
-	 * VFB must clear memory to prevent kernel info
-	 * leakage into userspace
-	 * VGA-based drivers MUST NOT clear memory if
-	 * they want to be able to take over vgacon
-	 */
-	memset(videomemory, 0, videomemorysize);
-
 	info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev);
 	if (!info)
 		goto err;
-- 
2.1.4


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

* [PATCH] fbdev: remove unnecessary memset in vfb
@ 2015-06-18 13:01 ` Marcin Chojnacki
  0 siblings, 0 replies; 8+ messages in thread
From: Marcin Chojnacki @ 2015-06-18 13:01 UTC (permalink / raw)
  To: plagnioj; +Cc: tomi.valkeinen, linux-fbdev, linux-kernel, Marcin Chojnacki

In vfb_probe memory is allocated using rvmalloc which automatically
sets the allocated memory to zero. This patch removes the second
unnecessary memset in vfb_probe.

Signed-off-by: Marcin Chojnacki <marcinch7@gmail.com>
---
 drivers/video/fbdev/vfb.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/video/fbdev/vfb.c b/drivers/video/fbdev/vfb.c
index 70a897b..b2d38b7 100644
--- a/drivers/video/fbdev/vfb.c
+++ b/drivers/video/fbdev/vfb.c
@@ -490,14 +490,6 @@ static int vfb_probe(struct platform_device *dev)
 	if (!(videomemory = rvmalloc(videomemorysize)))
 		return retval;
 
-	/*
-	 * VFB must clear memory to prevent kernel info
-	 * leakage into userspace
-	 * VGA-based drivers MUST NOT clear memory if
-	 * they want to be able to take over vgacon
-	 */
-	memset(videomemory, 0, videomemorysize);
-
 	info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev);
 	if (!info)
 		goto err;
-- 
2.1.4


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

* Re: [PATCH] fbdev: remove unnecessary memset in vfb
  2015-06-18 13:01 ` Marcin Chojnacki
@ 2015-08-20  7:56   ` Tomi Valkeinen
  -1 siblings, 0 replies; 8+ messages in thread
From: Tomi Valkeinen @ 2015-08-20  7:56 UTC (permalink / raw)
  To: Marcin Chojnacki, plagnioj; +Cc: linux-fbdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]



On 18/06/15 16:01, Marcin Chojnacki wrote:
> In vfb_probe memory is allocated using rvmalloc which automatically
> sets the allocated memory to zero. This patch removes the second
> unnecessary memset in vfb_probe.
> 
> Signed-off-by: Marcin Chojnacki <marcinch7@gmail.com>
> ---
>  drivers/video/fbdev/vfb.c | 8 --------
>  1 file changed, 8 deletions(-)

Thanks, queued for 4.3.

 Tomi


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

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

* Re: [PATCH] fbdev: remove unnecessary memset in vfb
@ 2015-08-20  7:56   ` Tomi Valkeinen
  0 siblings, 0 replies; 8+ messages in thread
From: Tomi Valkeinen @ 2015-08-20  7:56 UTC (permalink / raw)
  To: Marcin Chojnacki, plagnioj; +Cc: linux-fbdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]



On 18/06/15 16:01, Marcin Chojnacki wrote:
> In vfb_probe memory is allocated using rvmalloc which automatically
> sets the allocated memory to zero. This patch removes the second
> unnecessary memset in vfb_probe.
> 
> Signed-off-by: Marcin Chojnacki <marcinch7@gmail.com>
> ---
>  drivers/video/fbdev/vfb.c | 8 --------
>  1 file changed, 8 deletions(-)

Thanks, queued for 4.3.

 Tomi


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

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

* Re: [PATCH] fbdev: remove unnecessary memset in vfb
  2015-06-18 13:01 ` Marcin Chojnacki
@ 2015-08-20  8:21   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2015-08-20  8:21 UTC (permalink / raw)
  To: Marcin Chojnacki
  Cc: Jean-Christophe PLAGNIOL-VILLARD, Tomi Valkeinen,
	Linux Fbdev development list, linux-kernel

On Thu, Jun 18, 2015 at 3:01 PM, Marcin Chojnacki <marcinch7@gmail.com> wrote:
> In vfb_probe memory is allocated using rvmalloc which automatically
> sets the allocated memory to zero. This patch removes the second
> unnecessary memset in vfb_probe.
>
> Signed-off-by: Marcin Chojnacki <marcinch7@gmail.com>
> ---
>  drivers/video/fbdev/vfb.c | 8 --------
>  1 file changed, 8 deletions(-)
>
> diff --git a/drivers/video/fbdev/vfb.c b/drivers/video/fbdev/vfb.c
> index 70a897b..b2d38b7 100644
> --- a/drivers/video/fbdev/vfb.c
> +++ b/drivers/video/fbdev/vfb.c
> @@ -490,14 +490,6 @@ static int vfb_probe(struct platform_device *dev)
>         if (!(videomemory = rvmalloc(videomemorysize)))
>                 return retval;
>
> -       /*
> -        * VFB must clear memory to prevent kernel info
> -        * leakage into userspace
> -        * VGA-based drivers MUST NOT clear memory if
> -        * they want to be able to take over vgacon
> -        */
> -       memset(videomemory, 0, videomemorysize);
> -

As vfb also serves as a sample driver, I think it would be worthwhile to move
the comment to rvmalloc().

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] fbdev: remove unnecessary memset in vfb
@ 2015-08-20  8:21   ` Geert Uytterhoeven
  0 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2015-08-20  8:21 UTC (permalink / raw)
  To: Marcin Chojnacki
  Cc: Jean-Christophe PLAGNIOL-VILLARD, Tomi Valkeinen,
	Linux Fbdev development list, linux-kernel

On Thu, Jun 18, 2015 at 3:01 PM, Marcin Chojnacki <marcinch7@gmail.com> wrote:
> In vfb_probe memory is allocated using rvmalloc which automatically
> sets the allocated memory to zero. This patch removes the second
> unnecessary memset in vfb_probe.
>
> Signed-off-by: Marcin Chojnacki <marcinch7@gmail.com>
> ---
>  drivers/video/fbdev/vfb.c | 8 --------
>  1 file changed, 8 deletions(-)
>
> diff --git a/drivers/video/fbdev/vfb.c b/drivers/video/fbdev/vfb.c
> index 70a897b..b2d38b7 100644
> --- a/drivers/video/fbdev/vfb.c
> +++ b/drivers/video/fbdev/vfb.c
> @@ -490,14 +490,6 @@ static int vfb_probe(struct platform_device *dev)
>         if (!(videomemory = rvmalloc(videomemorysize)))
>                 return retval;
>
> -       /*
> -        * VFB must clear memory to prevent kernel info
> -        * leakage into userspace
> -        * VGA-based drivers MUST NOT clear memory if
> -        * they want to be able to take over vgacon
> -        */
> -       memset(videomemory, 0, videomemorysize);
> -

As vfb also serves as a sample driver, I think it would be worthwhile to move
the comment to rvmalloc().

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] fbdev: remove unnecessary memset in vfb
  2015-08-20  8:21   ` Geert Uytterhoeven
@ 2015-08-20  9:05     ` Tomi Valkeinen
  -1 siblings, 0 replies; 8+ messages in thread
From: Tomi Valkeinen @ 2015-08-20  9:05 UTC (permalink / raw)
  To: Geert Uytterhoeven, Marcin Chojnacki
  Cc: Jean-Christophe PLAGNIOL-VILLARD, Linux Fbdev development list,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2896 bytes --]


On 20/08/15 11:21, Geert Uytterhoeven wrote:
> On Thu, Jun 18, 2015 at 3:01 PM, Marcin Chojnacki <marcinch7@gmail.com> wrote:
>> In vfb_probe memory is allocated using rvmalloc which automatically
>> sets the allocated memory to zero. This patch removes the second
>> unnecessary memset in vfb_probe.
>>
>> Signed-off-by: Marcin Chojnacki <marcinch7@gmail.com>
>> ---
>>  drivers/video/fbdev/vfb.c | 8 --------
>>  1 file changed, 8 deletions(-)
>>
>> diff --git a/drivers/video/fbdev/vfb.c b/drivers/video/fbdev/vfb.c
>> index 70a897b..b2d38b7 100644
>> --- a/drivers/video/fbdev/vfb.c
>> +++ b/drivers/video/fbdev/vfb.c
>> @@ -490,14 +490,6 @@ static int vfb_probe(struct platform_device *dev)
>>         if (!(videomemory = rvmalloc(videomemorysize)))
>>                 return retval;
>>
>> -       /*
>> -        * VFB must clear memory to prevent kernel info
>> -        * leakage into userspace
>> -        * VGA-based drivers MUST NOT clear memory if
>> -        * they want to be able to take over vgacon
>> -        */
>> -       memset(videomemory, 0, videomemorysize);
>> -
> 
> As vfb also serves as a sample driver, I think it would be worthwhile to move
> the comment to rvmalloc().

I changed the patch as follows:


commit c0a3229313d6931a77e0c1e1c22e398c0312bf6f
Author: Marcin Chojnacki <marcinch7@gmail.com>
Date:   Thu Jun 18 15:01:52 2015 +0200

    fbdev: remove unnecessary memset in vfb
    
    In vfb_probe memory is allocated using rvmalloc which automatically
    sets the allocated memory to zero. This patch removes the second
    unnecessary memset in vfb_probe.
    
    Signed-off-by: Marcin Chojnacki <marcinch7@gmail.com>
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

diff --git a/drivers/video/fbdev/vfb.c b/drivers/video/fbdev/vfb.c
index 70a897b1e458..b9c2f81fb6b9 100644
--- a/drivers/video/fbdev/vfb.c
+++ b/drivers/video/fbdev/vfb.c
@@ -51,7 +51,14 @@ static void *rvmalloc(unsigned long size)
 	if (!mem)
 		return NULL;
 
-	memset(mem, 0, size); /* Clear the ram out, no junk to the user */
+	/*
+	 * VFB must clear memory to prevent kernel info
+	 * leakage into userspace
+	 * VGA-based drivers MUST NOT clear memory if
+	 * they want to be able to take over vgacon
+	 */
+
+	memset(mem, 0, size);
 	adr = (unsigned long) mem;
 	while (size > 0) {
 		SetPageReserved(vmalloc_to_page((void *)adr));
@@ -490,14 +497,6 @@ static int vfb_probe(struct platform_device *dev)
 	if (!(videomemory = rvmalloc(videomemorysize)))
 		return retval;
 
-	/*
-	 * VFB must clear memory to prevent kernel info
-	 * leakage into userspace
-	 * VGA-based drivers MUST NOT clear memory if
-	 * they want to be able to take over vgacon
-	 */
-	memset(videomemory, 0, videomemorysize);
-
 	info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev);
 	if (!info)
 		goto err;


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

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

* Re: [PATCH] fbdev: remove unnecessary memset in vfb
@ 2015-08-20  9:05     ` Tomi Valkeinen
  0 siblings, 0 replies; 8+ messages in thread
From: Tomi Valkeinen @ 2015-08-20  9:05 UTC (permalink / raw)
  To: Geert Uytterhoeven, Marcin Chojnacki
  Cc: Jean-Christophe PLAGNIOL-VILLARD, Linux Fbdev development list,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2896 bytes --]


On 20/08/15 11:21, Geert Uytterhoeven wrote:
> On Thu, Jun 18, 2015 at 3:01 PM, Marcin Chojnacki <marcinch7@gmail.com> wrote:
>> In vfb_probe memory is allocated using rvmalloc which automatically
>> sets the allocated memory to zero. This patch removes the second
>> unnecessary memset in vfb_probe.
>>
>> Signed-off-by: Marcin Chojnacki <marcinch7@gmail.com>
>> ---
>>  drivers/video/fbdev/vfb.c | 8 --------
>>  1 file changed, 8 deletions(-)
>>
>> diff --git a/drivers/video/fbdev/vfb.c b/drivers/video/fbdev/vfb.c
>> index 70a897b..b2d38b7 100644
>> --- a/drivers/video/fbdev/vfb.c
>> +++ b/drivers/video/fbdev/vfb.c
>> @@ -490,14 +490,6 @@ static int vfb_probe(struct platform_device *dev)
>>         if (!(videomemory = rvmalloc(videomemorysize)))
>>                 return retval;
>>
>> -       /*
>> -        * VFB must clear memory to prevent kernel info
>> -        * leakage into userspace
>> -        * VGA-based drivers MUST NOT clear memory if
>> -        * they want to be able to take over vgacon
>> -        */
>> -       memset(videomemory, 0, videomemorysize);
>> -
> 
> As vfb also serves as a sample driver, I think it would be worthwhile to move
> the comment to rvmalloc().

I changed the patch as follows:


commit c0a3229313d6931a77e0c1e1c22e398c0312bf6f
Author: Marcin Chojnacki <marcinch7@gmail.com>
Date:   Thu Jun 18 15:01:52 2015 +0200

    fbdev: remove unnecessary memset in vfb
    
    In vfb_probe memory is allocated using rvmalloc which automatically
    sets the allocated memory to zero. This patch removes the second
    unnecessary memset in vfb_probe.
    
    Signed-off-by: Marcin Chojnacki <marcinch7@gmail.com>
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

diff --git a/drivers/video/fbdev/vfb.c b/drivers/video/fbdev/vfb.c
index 70a897b1e458..b9c2f81fb6b9 100644
--- a/drivers/video/fbdev/vfb.c
+++ b/drivers/video/fbdev/vfb.c
@@ -51,7 +51,14 @@ static void *rvmalloc(unsigned long size)
 	if (!mem)
 		return NULL;
 
-	memset(mem, 0, size); /* Clear the ram out, no junk to the user */
+	/*
+	 * VFB must clear memory to prevent kernel info
+	 * leakage into userspace
+	 * VGA-based drivers MUST NOT clear memory if
+	 * they want to be able to take over vgacon
+	 */
+
+	memset(mem, 0, size);
 	adr = (unsigned long) mem;
 	while (size > 0) {
 		SetPageReserved(vmalloc_to_page((void *)adr));
@@ -490,14 +497,6 @@ static int vfb_probe(struct platform_device *dev)
 	if (!(videomemory = rvmalloc(videomemorysize)))
 		return retval;
 
-	/*
-	 * VFB must clear memory to prevent kernel info
-	 * leakage into userspace
-	 * VGA-based drivers MUST NOT clear memory if
-	 * they want to be able to take over vgacon
-	 */
-	memset(videomemory, 0, videomemorysize);
-
 	info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev);
 	if (!info)
 		goto err;


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

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

end of thread, other threads:[~2015-08-20  9:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-18 13:01 [PATCH] fbdev: remove unnecessary memset in vfb Marcin Chojnacki
2015-06-18 13:01 ` Marcin Chojnacki
2015-08-20  7:56 ` Tomi Valkeinen
2015-08-20  7:56   ` Tomi Valkeinen
2015-08-20  8:21 ` Geert Uytterhoeven
2015-08-20  8:21   ` Geert Uytterhoeven
2015-08-20  9:05   ` Tomi Valkeinen
2015-08-20  9:05     ` Tomi Valkeinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.