From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756597AbZEaGY3 (ORCPT ); Sun, 31 May 2009 02:24:29 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752280AbZEaGYW (ORCPT ); Sun, 31 May 2009 02:24:22 -0400 Received: from mail-fx0-f168.google.com ([209.85.220.168]:54225 "EHLO mail-fx0-f168.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751149AbZEaGYV convert rfc822-to-8bit (ORCPT ); Sun, 31 May 2009 02:24:21 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Q4t2maLyAWeduH8P1dPHbdKC2/Rie6cnGk+I9qEmqNAEepTTIM+SLnaXbLvWxFoogN sxDJiiQ79F0GVF989HbD+k7r3mLA3JBje8ahJVkcRvLY/OiQDV2RyzfAxmQ5ik3syjnD iGrHqAQIUGV+sHyYMeW9UCZll9agSEqvwRC4I= MIME-Version: 1.0 In-Reply-To: References: <20090531015537.GA8941@oblivion.subreption.com> Date: Sun, 31 May 2009 09:24:22 +0300 X-Google-Sender-Auth: f5a836039fd9ed22 Message-ID: <84144f020905302324r5e342f2dlfd711241ecfc8374@mail.gmail.com> Subject: Re: [PATCH] Use kzfree in tty buffer management to enforce data sanitization From: Pekka Enberg To: Linus Torvalds Cc: "Larry H." , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Rik van Riel , Alan Cox Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > >        memset(buf->data, 0, N_TTY_BUF_SIZE); >        if (PAGE_SIZE != N_TTY_BUF_SIZE) >                kfree(...) >        else >                free_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