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: <57519670.6050306@kernel.dk>
Date:	Fri, 3 Jun 2016 08:38:40 -0600
From:	Jens Axboe <axboe@...nel.dk>
To:	Baolin Wang <baolin.wang@...aro.org>, agk@...hat.com,
	snitzer@...hat.com, dm-devel@...hat.com,
	herbert@...dor.apana.org.au, davem@...emloft.net
Cc:	ebiggers3@...il.com, js1304@...il.com, tadeusz.struk@...el.com,
	smueller@...onox.de, standby24x7@...il.com, shli@...nel.org,
	dan.j.williams@...el.com, martin.petersen@...cle.com,
	sagig@...lanox.com, kent.overstreet@...il.com,
	keith.busch@...el.com, tj@...nel.org, ming.lei@...onical.com,
	broonie@...nel.org, arnd@...db.de, linux-crypto@...r.kernel.org,
	linux-block@...r.kernel.org, linux-raid@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [RFC v2 1/3] block: Introduce blk_bio_map_sg() to map one bio

On 05/27/2016 05:11 AM, Baolin Wang wrote:
> +/*
> + * Map a bio to scatterlist, return number of sg entries setup. Caller must
> + * make sure sg can hold bio segments entries.
> + */
> +int blk_bio_map_sg(struct request_queue *q, struct bio *bio,
> +		   struct scatterlist *sglist)
> +{
> +	struct scatterlist *sg = NULL;
> +	int nsegs = 0;
> +
> +	if (bio)
> +		nsegs = __blk_bios_map_sg(q, bio, sglist, &sg, true);
> +
> +	if (sg)
> +		sg_mark_end(sg);

Put that if (sg) inside the if (bio) section, 'sg' isn't going to be
non-NULL outside of that.

Additionally, who would call this with a NULL bio? That seems odd, I'd
get rid of that check completely.

-- 
Jens Axboe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ