[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <wrfjmvi9221u.fsf@redhat.com>
Date: Wed, 12 Oct 2016 08:18:37 -0400
From: Jes Sorensen <Jes.Sorensen@...hat.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Richard Weinberger <richard.weinberger@...il.com>,
SF Markus Elfring <elfring@...rs.sourceforge.net>,
"linux-raid\@vger.kernel.org" <linux-raid@...r.kernel.org>,
Christoph Hellwig <hch@....de>,
Guoqing Jiang <gqjiang@...e.com>, Jens Axboe <axboe@...com>,
Mike Christie <mchristi@...hat.com>,
Neil Brown <neilb@...e.com>, Shaohua Li <shli@...nel.org>,
Tomasz Majchrzak <tomasz.majchrzak@...el.com>,
LKML <linux-kernel@...r.kernel.org>,
"kernel-janitors\@vger.kernel.org" <kernel-janitors@...r.kernel.org>,
Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 24/54] md/raid1: Improve another size determination in setup_conf()
Dan Carpenter <dan.carpenter@...cle.com> 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
Powered by blists - more mailing lists