linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: linux-block@vger.kernel.org, jasowang@redhat.com,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Christoph Hellwig <hch@lst.de>,
	Xie Yongji <xieyongji@bytedance.com>
Subject: Re: [PATCH] virtio-blk: limit seg_max to a safe value
Date: Wed, 19 May 2021 09:57:02 +0200	[thread overview]
Message-ID: <20210519075702.GA4225@lst.de> (raw)
In-Reply-To: <20210518150415.152730-1-stefanha@redhat.com>

On Tue, May 18, 2021 at 04:04:15PM +0100, Stefan Hajnoczi wrote:
> +	/* Prevent integer overflows and excessive blk-mq req cmd_size */
> +	sg_elems = min_t(u32, sg_elems, SG_MAX_SEGMENTS);

Please pick your own constant here instead of abusing some kernel
implementation detail (that is fairly SCSI specific to start with).

It might be useful to also document such limits, even if just advisory,
in the virtio spec.

  reply	other threads:[~2021-05-19  7:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 15:04 [PATCH] virtio-blk: limit seg_max to a safe value Stefan Hajnoczi
2021-05-19  7:57 ` Christoph Hellwig [this message]
2021-05-19  8:40   ` Stefan Hajnoczi

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=20210519075702.GA4225@lst.de \
    --to=hch@lst.de \
    --cc=jasowang@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=xieyongji@bytedance.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).