From patchwork Thu Aug 20 09:05:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 7042531 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2F3ECC05AC for ; Thu, 20 Aug 2015 09:05:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 824D920525 for ; Thu, 20 Aug 2015 09:05:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 58A1820524 for ; Thu, 20 Aug 2015 09:05:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751569AbbHTJFd (ORCPT ); Thu, 20 Aug 2015 05:05:33 -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 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id t7K95OHH023677; Thu, 20 Aug 2015 04:05:24 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t7K95NTN027489; Thu, 20 Aug 2015 04:05:23 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Thu, 20 Aug 2015 04:05:23 -0500 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t7K95LHZ021969; Thu, 20 Aug 2015 04:05:22 -0500 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: Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 = 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 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 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; - 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;