linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Damien Le Moal <damien.lemoal@hgst.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-scsi@vger.kernel.org,
	Christoph Hellwig <hch@lst.de>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Shaun Tancheff <shaun.tancheff@seagate.com>
Subject: Re: [PATCH v2 7/7] blk-zoned: implement ioctls
Date: Mon, 26 Sep 2016 09:37:52 -0700	[thread overview]
Message-ID: <20160926163752.GA13876@infradead.org> (raw)
In-Reply-To: <1474888483-29762-8-git-send-email-damien.lemoal@hgst.com>

> +	zones = kzalloc(sizeof(struct blk_zone) * rep.nr_zones,
> +			GFP_KERNEL);
> +	if (!zones)
> +		return -ENOMEM;

This should use kcalloc to get us underflow checking for the user
controlled allocation size.

> +	if (copy_to_user(argp, &rep, sizeof(struct blk_zone_report))) {
> +		ret = -EFAULT;
> +		goto out;
> +	}
> +
> +	if (rep.nr_zones) {
> +		if (copy_to_user(argp + sizeof(struct blk_zone_report), zones,
> +				 sizeof(struct blk_zone) * rep.nr_zones))
> +			ret = -EFAULT;
> +	}

We could actually do this with a single big copy_to_user.  Not that
it really matters, though..

> -/*
> - * Zone type.
> - */
> -enum blk_zone_type {
> -	BLK_ZONE_TYPE_UNKNOWN,
> -	BLK_ZONE_TYPE_CONVENTIONAL,
> -	BLK_ZONE_TYPE_SEQWRITE_REQ,
> -	BLK_ZONE_TYPE_SEQWRITE_PREF,
> -};

Please don't move this code around after it was added just two
patches earlier.  I'd say just split adding the new blkzoned.h
uapi header into a patch of it's own and add that before the
core block code.

  reply	other threads:[~2016-09-26 16:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26 11:14 [PATCH v2 0/7] ZBC / Zoned block device support Damien Le Moal
2016-09-26 11:14 ` [PATCH v2 1/7] block: Add 'zoned' queue limit Damien Le Moal
2016-09-27 21:09   ` Shaun Tancheff
2016-09-26 11:14 ` [PATCH v2 2/7] blk-sysfs: Add 'chunk_sectors' to sysfs attributes Damien Le Moal
2016-09-27 21:10   ` Shaun Tancheff
2016-09-26 11:14 ` [PATCH v2 3/7] block: update chunk_sectors in blk_stack_limits() Damien Le Moal
2016-09-27 21:12   ` Shaun Tancheff
2016-09-26 11:14 ` [PATCH v2 4/7] block: Define zoned block device operations Damien Le Moal
2016-09-26 11:14 ` [PATCH v2 5/7] block: Implement support for zoned block devices Damien Le Moal
2016-09-27 18:51   ` [PATCH v3 " Shaun Tancheff
2016-09-26 11:14 ` [PATCH v2 6/7] sd: Implement support for ZBC devices Damien Le Moal
2016-09-27 21:08   ` Shaun Tancheff
2016-09-26 11:14 ` [PATCH v2 7/7] blk-zoned: implement ioctls Damien Le Moal
2016-09-26 16:37   ` Christoph Hellwig [this message]
2016-09-26 23:12     ` Shaun Tancheff
2016-09-27 18:24       ` Christoph Hellwig
2016-09-26 23:30     ` Damien Le Moal
2016-09-26 23:58       ` Shaun Tancheff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160926163752.GA13876@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@hgst.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=shaun.tancheff@seagate.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).