Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757376AbbEVSiy (ORCPT ); Fri, 22 May 2015 14:38:54 -0400 Received: from g4t3426.houston.hp.com ([15.201.208.54]:50915 "EHLO g4t3426.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756771AbbEVSiw convert rfc822-to-8bit (ORCPT ); Fri, 22 May 2015 14:38:52 -0400 From: "Elliott, Robert (Server Storage)" To: Dan Williams , "axboe@kernel.dk" CC: "linux-nvdimm@lists.01.org" , "neilb@suse.de" , "gregkh@linuxfoundation.org" , "linux-kernel@vger.kernel.org" , "hch@lst.de" , "linux-acpi@vger.kernel.org" , "mingo@kernel.org" Subject: RE: [PATCH v3 14/21] libnd: blk labels and namespace instantiation Thread-Topic: [PATCH v3 14/21] libnd: blk labels and namespace instantiation Thread-Index: AQHQk0ACKYNK+/VoAEiTU8cdkg9W1J2IVBWg Date: Fri, 22 May 2015 18:37:31 +0000 Message-ID: <94D0CD8314A33A4D9D801C0FE68B40295A91FBF3@G9W0745.americas.hpqcorp.net> References: <20150520205536.32249.89779.stgit@dwillia2-desk3.amr.corp.intel.com> <20150520205727.32249.79684.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <20150520205727.32249.79684.stgit@dwillia2-desk3.amr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [16.210.48.26] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1678 Lines: 49 > -----Original Message----- > From: Linux-nvdimm [mailto:linux-nvdimm-bounces@lists.01.org] On Behalf Of > Dan Williams > Sent: Wednesday, May 20, 2015 3:57 PM > To: axboe@kernel.dk > Cc: linux-nvdimm@lists.01.org; neilb@suse.de; gregkh@linuxfoundation.org; > linux-kernel@vger.kernel.org; hch@lst.de; linux-acpi@vger.kernel.org; > mingo@kernel.org > Subject: [PATCH v3 14/21] libnd: blk labels and namespace instantiation > ... > @@ -1029,6 +1244,173 @@ static struct device **create_namespace_pmem(struct > nd_region *nd_region) > return NULL; > } > > +struct resource *nsblk_add_resource(struct nd_region *nd_region, > + struct nd_dimm_drvdata *ndd, struct nd_namespace_blk *nsblk, > + resource_size_t start) > +{ > + struct nd_label_id label_id; > + struct resource *res; > + > + nd_label_gen_id(&label_id, nsblk->uuid, NSLABEL_FLAG_LOCAL); > + nsblk->res = krealloc(nsblk->res, > + sizeof(void *) * (nsblk->num_resources + 1), > + GFP_KERNEL); > + if (!nsblk->res) > + return NULL; scripts/checkpatch.pl doesn't like that: WARNING: Reusing the krealloc arg is almost always a bug #1411: FILE: drivers/block/nd/namespace_devs.c:1411: + nsblk->res = krealloc(nsblk->res, The reasoning (https://lkml.org/lkml/2013/3/14/558) is: "If krealloc() returns NULL, it *doesn't* free the original. So any code of the form 'foo = krealloc(foo, ?);' is almost certainly a bug." --- Robert Elliott, HP Server Storage -- 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/