linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: "Bjørn Mork" <bjorn@mork.no>, "Alan Stern" <stern@rowland.harvard.edu>
Cc: Hans Petter Selasky <hps@selasky.org>,
	Oliver Neukum <oneukum@suse.com>,
	linux-usb@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [RFC] CDC-NCM: avoid overflow in sanity checking
Date: Mon, 14 Feb 2022 20:30:02 +0100	[thread overview]
Message-ID: <393ec81c-52b4-842b-1ecd-4ffc29743665@suse.com> (raw)
In-Reply-To: <87k0e1oory.fsf@miraculix.mork.no>


On 11.02.22 08:17, Bjørn Mork wrote:
> Alan Stern <stern@rowland.harvard.edu> writes:
>
>
> Only  is that the existing code wants the inverted result:
>
>  	if (offset > skb_in->len || len > skb_in->len - offset) ...
>
> with all values unsigned.

Its logic is

if (!sane(fragment))
    continue;
process(fragment);

rather than

if (sane(fragment))
    process(fragment);

A simple matter of inversion.

> And there you point out my problem:  discipline :-)
>
Do we still agree that unsigned integers are the better option?

    Regards
        Oliver


  reply	other threads:[~2022-02-14 20:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 15:54 [RFC] CDC-NCM: avoid overflow in sanity checking Oliver Neukum
2022-02-10 16:38 ` Hans Petter Selasky
2022-02-10 17:27   ` Bjørn Mork
2022-02-10 22:50     ` Hans Petter Selasky
2022-02-11  1:54       ` Alan Stern
2022-02-11  7:17         ` Bjørn Mork
2022-02-14 19:30           ` Oliver Neukum [this message]
2022-02-14 19:41             ` Bjørn Mork

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=393ec81c-52b4-842b-1ecd-4ffc29743665@suse.com \
    --to=oneukum@suse.com \
    --cc=bjorn@mork.no \
    --cc=hps@selasky.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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).