Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261897AbVDESx5 (ORCPT ); Tue, 5 Apr 2005 14:53:57 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261733AbVDESxN (ORCPT ); Tue, 5 Apr 2005 14:53:13 -0400 Received: from host201.dif.dk ([193.138.115.201]:10512 "EHLO diftmgw2.backbone.dif.dk") by vger.kernel.org with ESMTP id S261897AbVDESwG (ORCPT ); Tue, 5 Apr 2005 14:52:06 -0400 Date: Tue, 5 Apr 2005 20:54:07 +0200 (CEST) From: Jesper Juhl To: Paulo Marques cc: LKML Subject: Re: RFC: turn kmalloc+memset(,0,) into kcalloc In-Reply-To: <4252BC37.8030306@grupopie.com> Message-ID: References: <4252BC37.8030306@grupopie.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 697 Lines: 27 On Tue, 5 Apr 2005, Paulo Marques wrote: > Hi, > I noticed there are a number of places in the kernel that do: > ptr = kmalloc(n * size, ...) > if (!ptr) > goto out; > memset(ptr, 0, n * size); > It seems that these could be replaced by: > ptr = kcalloc(n, size, ...) > if (!ptr) > goto out; or simply if (!(ptr = kcalloc(n, size, ...))) goto out; and save an additional line of screen realestate while you are at it... -- Jesper Juhl - 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/