All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Shigeru Yoshida <syoshida@redhat.com>,
	mst@redhat.com, jasowang@redhat.com
Cc: pbonzini@redhat.com, stefanha@redhat.com,
	virtualization@lists.linux-foundation.org,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	suwan.kim027@gmail.com
Subject: Re: [PATCH v2] virtio-blk: Avoid use-after-free on suspend/resume
Date: Thu, 11 Aug 2022 17:04:01 -0600	[thread overview]
Message-ID: <05cfb9dc-c740-5764-35f9-b5636e0577cb@kernel.dk> (raw)
In-Reply-To: <20220810160948.959781-1-syoshida@redhat.com>

On 8/10/22 10:09 AM, Shigeru Yoshida wrote:
> +static inline struct virtio_blk_vq *get_virtio_blk_vq(struct blk_mq_hw_ctx *hctx)
> +{
> +	struct virtio_blk *vblk = hctx->queue->queuedata;
> +	struct virtio_blk_vq *vq = &vblk->vqs[hctx->queue_num];
> +
> +	return vq;
> +}

Would probably be cleaner as:

static struct virtio_blk_vq *get_virtio_blk_vq(struct blk_mq_hw_ctx *hctx)
{
	struct virtio_blk *vblk = hctx->queue->queuedata;

	return &vblk->vqs[hctx->queue_num];
}

dropping the 'vq' variable, and also dropping the inline as the compiler
will work that out anyway.

Apart from that minor nit, looks good to me.

-- 
Jens Axboe


WARNING: multiple messages have this Message-ID (diff)
From: Jens Axboe <axboe@kernel.dk>
To: Shigeru Yoshida <syoshida@redhat.com>,
	mst@redhat.com, jasowang@redhat.com
Cc: linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-block@vger.kernel.org, stefanha@redhat.com,
	pbonzini@redhat.com, suwan.kim027@gmail.com
Subject: Re: [PATCH v2] virtio-blk: Avoid use-after-free on suspend/resume
Date: Thu, 11 Aug 2022 17:04:01 -0600	[thread overview]
Message-ID: <05cfb9dc-c740-5764-35f9-b5636e0577cb@kernel.dk> (raw)
In-Reply-To: <20220810160948.959781-1-syoshida@redhat.com>

On 8/10/22 10:09 AM, Shigeru Yoshida wrote:
> +static inline struct virtio_blk_vq *get_virtio_blk_vq(struct blk_mq_hw_ctx *hctx)
> +{
> +	struct virtio_blk *vblk = hctx->queue->queuedata;
> +	struct virtio_blk_vq *vq = &vblk->vqs[hctx->queue_num];
> +
> +	return vq;
> +}

Would probably be cleaner as:

static struct virtio_blk_vq *get_virtio_blk_vq(struct blk_mq_hw_ctx *hctx)
{
	struct virtio_blk *vblk = hctx->queue->queuedata;

	return &vblk->vqs[hctx->queue_num];
}

dropping the 'vq' variable, and also dropping the inline as the compiler
will work that out anyway.

Apart from that minor nit, looks good to me.

-- 
Jens Axboe

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2022-08-11 23:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10 16:09 [PATCH v2] virtio-blk: Avoid use-after-free on suspend/resume Shigeru Yoshida
2022-08-11 12:52 ` Kim Suwan
2022-08-11 17:23 ` Stefan Hajnoczi
2022-08-11 17:23   ` Stefan Hajnoczi
2022-08-11 23:04 ` Jens Axboe [this message]
2022-08-11 23:04   ` Jens Axboe

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=05cfb9dc-c740-5764-35f9-b5636e0577cb@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=jasowang@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=suwan.kim027@gmail.com \
    --cc=syoshida@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.