Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754799AbcJLMTA (ORCPT ); Wed, 12 Oct 2016 08:19:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41862 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754746AbcJLMSj (ORCPT ); Wed, 12 Oct 2016 08:18:39 -0400 From: Jes Sorensen To: Dan Carpenter Cc: Richard Weinberger , SF Markus Elfring , "linux-raid\@vger.kernel.org" , Christoph Hellwig , Guoqing Jiang , Jens Axboe , Mike Christie , Neil Brown , Shaohua Li , Tomasz Majchrzak , LKML , "kernel-janitors\@vger.kernel.org" , Julia Lawall Subject: Re: [PATCH 24/54] md/raid1: Improve another size determination in setup_conf() References: <566ABCD9.1060404@users.sourceforge.net> <786843ef-4b6f-eb04-7326-2f6f5b408826@users.sourceforge.net> <9831fce9-d689-89e4-dec8-50cadcd13fdd@users.sourceforge.net> <20161007075345.GB6039@mwanda> <20161012074307.GB5687@mwanda> Date: Wed, 12 Oct 2016 08:18:37 -0400 In-Reply-To: <20161012074307.GB5687@mwanda> (Dan Carpenter's message of "Wed, 12 Oct 2016 11:28:39 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 12 Oct 2016 12:18:38 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 859 Lines: 24 Dan Carpenter writes: > Compare: > > foo = kmalloc(sizeof(*foo), GFP_KERNEL); > > This says you are allocating enough space for foo. It can be reviewed > by looking at one line. If you change the type of foo it will still > work. > > foo = kmalloc(sizeof(struct whatever), GFP_KERNEL); > > There isn't enough information to say if this is correct. If you change > the type of foo then you have to update the allocation as well. > > It's not a super common type of bug, but I see it occasionally. I know what you are saying, but the latter in my book is easier to read and reminds you what the type is when you review the code. Point being this comes down to personal preference and stating that the former is the right way or making that a rule and using checkpatch to harrass people with patches to change it is bogus. Jes