Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932412AbcJLI3r (ORCPT ); Wed, 12 Oct 2016 04:29:47 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:24726 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932283AbcJLI3o (ORCPT ); Wed, 12 Oct 2016 04:29:44 -0400 Date: Wed, 12 Oct 2016 11:28:39 +0300 From: Dan Carpenter To: Jes Sorensen 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() Message-ID: <20161012074307.GB5687@mwanda> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 480 Lines: 17 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. regards, dan carpenter