From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail202.messagelabs.com (mail202.messagelabs.com [216.82.254.227]) by kanga.kvack.org (Postfix) with SMTP id EBEA66B004F for ; Sun, 31 May 2009 02:24:01 -0400 (EDT) Received: by bwz21 with SMTP id 21so9275735bwz.38 for ; Sat, 30 May 2009 23:24:22 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <20090531015537.GA8941@oblivion.subreption.com> Date: Sun, 31 May 2009 09:24:22 +0300 Message-ID: <84144f020905302324r5e342f2dlfd711241ecfc8374@mail.gmail.com> Subject: Re: [PATCH] Use kzfree in tty buffer management to enforce data sanitization From: Pekka Enberg Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sender: owner-linux-mm@kvack.org To: Linus Torvalds Cc: "Larry H." , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Rik van Riel , Alan Cox List-ID: Hi Linus, On Sat, 30 May 2009, Larry H. wrote: >> >> This patch doesn't affect fastpaths. On Sun, May 31, 2009 at 5:04 AM, Linus Torvalds wrote: > This patch is ugly as hell. > > You already know the size of the data to clear. > > If we actually wanted this (and I am in _no_way_ saying we do), the only > sane thing to do is to just do > > =A0 =A0 =A0 =A0memset(buf->data, 0, N_TTY_BUF_SIZE); > =A0 =A0 =A0 =A0if (PAGE_SIZE !=3D N_TTY_BUF_SIZE) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0kfree(...) > =A0 =A0 =A0 =A0else > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0free_page(...) > > > but quite frankly, I'm not convinced about these patches at all. I wonder why the tty code has that N_TTY_BUF_SIZE special casing in the first place? I think we can probably just get rid of it and thus we can use kzfree() here if we want to. Pekka -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org