From: Bart Van Assche <bvanassche@acm.org>
To: Wang Yingjie <x-professor@outlook.com>,
"mkp@kernel.org" <mkp@kernel.org>,
"axboe@kernel.dk" <axboe@kernel.dk>
Cc: "fujita.tomonori@lab.ntt.co.jp" <fujita.tomonori@lab.ntt.co.jp>,
"James.Bottomley@HansenPartnership.com"
<James.Bottomley@HansenPartnership.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] scsi: handle out-of-range SG_SET_TIMEOUT values
Date: Wed, 21 Oct 2026 13:29:04 -0700 [thread overview]
Message-ID: <eb20226b-cfae-4b10-b42c-1b12c2d17687@acm.org> (raw)
In-Reply-To: <20261021181804.136336-1-x-professor@outlook.com>
On 10/21/26 11:18 AM, Wang Yingjie wrote:
> diff --git a/block/bsg.c b/block/bsg.c
> index 82aaf3cee5825..632b3f6d98b29 100644
> --- a/block/bsg.c
> +++ b/block/bsg.c
> @@ -132,7 +132,11 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> case SG_SET_TIMEOUT:
> if (get_user(val, intp))
> return -EFAULT;
> - bd->timeout = clock_t_to_jiffies(val);
> + if (val < 0)
> + return -EIO;
> + bd->timeout = min_t(unsigned long, clock_t_to_jiffies(val),
> + min_t(unsigned long, UINT_MAX,
> + MAX_JIFFY_OFFSET));
MAX_JIFFY_OFFSET is guaranteed to be larger than UINT_MAX so the second
min_t() expression can be changed into UINT_MAX. Additionally, please
use min() instead of min_t(). min() has been modified recently such that
it allows some type promotions.
Thanks,
Bart.
next prev parent reply other threads:[~2026-10-21 20:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-17 8:45 [PATCH] scsi: reject negative " Wang Yingjie
2026-10-19 21:34 ` Bart Van Assche
2026-10-21 18:18 ` [PATCH v2] scsi: handle out-of-range " Wang Yingjie
2026-10-21 20:29 ` Bart Van Assche [this message]
2026-10-22 2:55 ` [PATCH v3] " Wang Yingjie
2026-10-22 3:24 ` Bart Van Assche
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=eb20226b-cfae-4b10-b42c-1b12c2d17687@acm.org \
--to=bvanassche@acm.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=axboe@kernel.dk \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mkp@kernel.org \
--cc=x-professor@outlook.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
all inboxes | Powered by JetHome®