lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <94D0CD8314A33A4D9D801C0FE68B40295A91FBF3@G9W0745.americas.hpqcorp.net>
Date:	Fri, 22 May 2015 18:37:31 +0000
From:	"Elliott, Robert (Server Storage)" <Elliott@...com>
To:	Dan Williams <dan.j.williams@...el.com>,
	"axboe@...nel.dk" <axboe@...nel.dk>
CC:	"linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>,
	"neilb@...e.de" <neilb@...e.de>,
	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"hch@....de" <hch@....de>,
	"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
	"mingo@...nel.org" <mingo@...nel.org>
Subject: RE: [PATCH v3 14/21] libnd: blk labels and namespace instantiation


> -----Original Message-----
> From: Linux-nvdimm [mailto:linux-nvdimm-bounces@...ts.01.org] On Behalf Of
> Dan Williams
> Sent: Wednesday, May 20, 2015 3:57 PM
> To: axboe@...nel.dk
> Cc: linux-nvdimm@...ts.01.org; neilb@...e.de; gregkh@...uxfoundation.org;
> linux-kernel@...r.kernel.org; hch@....de; linux-acpi@...r.kernel.org;
> mingo@...nel.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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ