From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Oliver Neukum <oneukum@suse.com>
Cc: Griffin Kroah-Hartman <griffin@kroah.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] usb: gadget: function: rndis: add length check to response query
Date: Thu, 9 Jul 2026 07:34:36 +0200 [thread overview]
Message-ID: <2026070900-sudden-tapestry-195d@gregkh> (raw)
In-Reply-To: <232723a0-328f-4929-9525-d5f00d498636@suse.com>
On Wed, Jul 08, 2026 at 06:24:16PM +0200, Oliver Neukum wrote:
> Hi,
>
> On 08.07.26 13:08, Griffin Kroah-Hartman wrote:
> > @@ -598,6 +599,13 @@ static int rndis_query_response(struct rndis_params *params,
> > if (!params->dev)
> > return -ENOTSUPP;
> > + BufLength = le32_to_cpu(buf->InformationBufferLength);
> > + BufOffset = le32_to_cpu(buf->InformationBufferOffset);
> > + if ((BufLength > RNDIS_MAX_TOTAL_SIZE) ||
> > + (BufOffset > RNDIS_MAX_TOTAL_SIZE) ||
> > + (BufOffset + 8 >= RNDIS_MAX_TOTAL_SIZE))
>
> Wouldn't those last two lines be more efficiently done with:
>
> BufOffset >= RNDIS_MAX_TOTAL_SIZE - 8
Probably, but doesn't the compiler turn them into the same result?
Also, rndis_set_response() has this same check, so at least everything
is consistent :)
thanks,
greg k-h
next prev parent reply other threads:[~2026-07-09 5:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 11:08 [PATCH 0/2] Error checking in rndis Griffin Kroah-Hartman
2026-07-08 11:08 ` [PATCH 1/2] usb: gadget: function: rndis: add length check to response query Griffin Kroah-Hartman
2026-07-08 16:24 ` Oliver Neukum
2026-07-09 5:34 ` Greg Kroah-Hartman [this message]
2026-07-08 11:08 ` [PATCH 2/2] usb: gadget: function: rndis: add length check for header Griffin Kroah-Hartman
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=2026070900-sudden-tapestry-195d@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=griffin@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.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