Displaying 6 results from an estimated 6 matches for "virtblk_valid_block_size".
2020 Jul 15
3
[PATCH] virtio-blk: check host supplied logical block size
...x 980df853ee497..36dda31cc4e96 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -681,6 +681,12 @@ static const struct blk_mq_ops virtio_mq_ops = {
static unsigned int virtblk_queue_depth;
module_param_named(queue_depth, virtblk_queue_depth, uint, 0444);
+
+static bool virtblk_valid_block_size(unsigned int blksize)
+{
+ return blksize >= 512 && blksize <= PAGE_SIZE && is_power_of_2(blksize);
+}
+
static int virtblk_probe(struct virtio_device *vdev)
{
struct virtio_blk *vblk;
@@ -809,9 +815,16 @@ static int virtblk_probe(struct virtio_device *vdev)
err = virtio...
2020 Jul 15
3
[PATCH] virtio-blk: check host supplied logical block size
...x 980df853ee497..36dda31cc4e96 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -681,6 +681,12 @@ static const struct blk_mq_ops virtio_mq_ops = {
static unsigned int virtblk_queue_depth;
module_param_named(queue_depth, virtblk_queue_depth, uint, 0444);
+
+static bool virtblk_valid_block_size(unsigned int blksize)
+{
+ return blksize >= 512 && blksize <= PAGE_SIZE && is_power_of_2(blksize);
+}
+
static int virtblk_probe(struct virtio_device *vdev)
{
struct virtio_blk *vblk;
@@ -809,9 +815,16 @@ static int virtblk_probe(struct virtio_device *vdev)
err = virtio...
2020 Jul 15
2
[PATCH] virtio-blk: check host supplied logical block size
...+++ b/drivers/block/virtio_blk.c
> > @@ -681,6 +681,12 @@ static const struct blk_mq_ops virtio_mq_ops =
> > {
> > static unsigned int virtblk_queue_depth;
> > module_param_named(queue_depth, virtblk_queue_depth, uint, 0444);
> >
> > +
> > +static bool virtblk_valid_block_size(unsigned int blksize)
> > +{
> > + return blksize >= 512 && blksize <= PAGE_SIZE &&
> > is_power_of_2(blksize);
> > +}
> > +
>
> Is this a blk core assumption? in that case, does not this belong
> in blk core?
It is a blk core assumptio...
2020 Jul 15
2
[PATCH] virtio-blk: check host supplied logical block size
...+++ b/drivers/block/virtio_blk.c
> > @@ -681,6 +681,12 @@ static const struct blk_mq_ops virtio_mq_ops =
> > {
> > static unsigned int virtblk_queue_depth;
> > module_param_named(queue_depth, virtblk_queue_depth, uint, 0444);
> >
> > +
> > +static bool virtblk_valid_block_size(unsigned int blksize)
> > +{
> > + return blksize >= 512 && blksize <= PAGE_SIZE &&
> > is_power_of_2(blksize);
> > +}
> > +
>
> Is this a blk core assumption? in that case, does not this belong
> in blk core?
It is a blk core assumptio...
2020 Jul 15
0
[PATCH] virtio-blk: check host supplied logical block size
...t; --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -681,6 +681,12 @@ static const struct blk_mq_ops virtio_mq_ops = {
> static unsigned int virtblk_queue_depth;
> module_param_named(queue_depth, virtblk_queue_depth, uint, 0444);
>
> +
> +static bool virtblk_valid_block_size(unsigned int blksize)
> +{
> + return blksize >= 512 && blksize <= PAGE_SIZE && is_power_of_2(blksize);
> +}
> +
Is this a blk core assumption? in that case, does not this belong
in blk core?
> static int virtblk_probe(struct virtio_device *vdev)
> {
>...
2020 Jul 15
0
[PATCH] virtio-blk: check host supplied logical block size
...gt; > > @@ -681,6 +681,12 @@ static const struct blk_mq_ops virtio_mq_ops =
> > > {
> > > static unsigned int virtblk_queue_depth;
> > > module_param_named(queue_depth, virtblk_queue_depth, uint, 0444);
> > >
> > > +
> > > +static bool virtblk_valid_block_size(unsigned int blksize)
> > > +{
> > > + return blksize >= 512 && blksize <= PAGE_SIZE &&
> > > is_power_of_2(blksize);
> > > +}
> > > +
> >
> > Is this a blk core assumption? in that case, does not this belong
> >...