Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751697AbbHTJFe (ORCPT ); Thu, 20 Aug 2015 05:05:34 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:42449 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750714AbbHTJFc (ORCPT ); Thu, 20 Aug 2015 05:05:32 -0400 Message-ID: <55D59851.7010205@ti.com> Date: Thu, 20 Aug 2015 12:05:21 +0300 From: Tomi Valkeinen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Geert Uytterhoeven , Marcin Chojnacki CC: Jean-Christophe PLAGNIOL-VILLARD , Linux Fbdev development list , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] fbdev: remove unnecessary memset in vfb References: <1434632512-128161-1-git-send-email-marcinch7@gmail.com> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DV0QPjE4whHF11DQkM748awaHQ9C06tTF" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4265 Lines: 121 --DV0QPjE4whHF11DQkM748awaHQ9C06tTF Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 20/08/15 11:21, Geert Uytterhoeven wrote: > On Thu, Jun 18, 2015 at 3:01 PM, 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 >> --- >> 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 =3D 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); >> - >=20 > As vfb also serves as a sample driver, I think it would be worthwhile t= o move > the comment to rvmalloc(). I changed the patch as follows: commit c0a3229313d6931a77e0c1e1c22e398c0312bf6f Author: Marcin Chojnacki Date: Thu Jun 18 15:01:52 2015 +0200 fbdev: remove unnecessary memset in vfb =20 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. =20 Signed-off-by: Marcin Chojnacki Signed-off-by: Tomi Valkeinen 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; =20 - 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 =3D (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 =3D rvmalloc(videomemorysize))) return retval; =20 - /* - * 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 =3D framebuffer_alloc(sizeof(u32) * 256, &dev->dev); if (!info) goto err; --DV0QPjE4whHF11DQkM748awaHQ9C06tTF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJV1ZhRAAoJEPo9qoy8lh71QTkQAKlKG+FPvIiQAns5t2ANrKvf w/OuW389gtyl2m7KlHmCx8NoeZ2fqrsgmZr8woZ4lcZDtSyN4dfVeUiJr/crIXME kpl+w1VL7PKDXD+0ZVIs9RvuGBg/b9DSQKHSoJP/6e/fve6KrPPPyUfz6oO/dxho Lk9N9jvTUsbAysIhIPXf6kGVFk0KXItkQ2CC03jFiEgzc4Aea+2ihXEQS6nPTbVb LkvN2xcNJyGQN1i4i7UW6WiCd2izVckgzLgW0IANKcXvsSTSGQKxYc66xOmTCF0f Lt/Jt5m6rGQ2HlSoxNWbAYtV55eGipbslMmReGjnGAQx8B0IR6sLxEvV9uETzOFi S7N51DynuyL0o/sw+mngIKhP5tvKwEMUTtSsiTawMh3Wc+xh3DLEsTz/njAUEAya A0BPFVHG7Dm8w9RgfW06OXiWRjVgIT1/bYp4dIS8g8BMcl/hy8ITrL1/kiQGCKtN yOGmA9SlLBJoHwg0lAKpQYs4rN0WBDogwekVynvOGG13edUt6VPq2W45Uw3CKtv6 6PhBbssIkmtdV120IGIBU+aStkbZc+NmNj7lHvguGCvRSuzjqLW/dPdslx1IM7TR A/1RIa+IqGQqLRFIrIH5E2JJFYD/rShq2fU8+qCBsWSVZS4TXFbRRXii+DPLma12 1Se1SQqz+wqFxsn+T+sC =9w9q -----END PGP SIGNATURE----- --DV0QPjE4whHF11DQkM748awaHQ9C06tTF-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/