Linux USB
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Griffin Kroah-Hartman <griffin@kroah.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: 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: Wed, 8 Jul 2026 18:24:16 +0200	[thread overview]
Message-ID: <232723a0-328f-4929-9525-d5f00d498636@suse.com> (raw)
In-Reply-To: <20260708-usb-gadget-rndis-v1-1-e77e026dcc6a@kroah.com>

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

	Regards
		Oliver



  reply	other threads:[~2026-07-08 16:24 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 [this message]
2026-07-09  5:34     ` Greg Kroah-Hartman
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=232723a0-328f-4929-9525-d5f00d498636@suse.com \
    --to=oneukum@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=griffin@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox