[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF=yD-KnjmCkqZuphj4yJdpB0j6NuBXGHUev4Z1zecN8+95d-Q@mail.gmail.com>
Date: Thu, 17 Aug 2017 10:37:31 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: David Laight <David.Laight@...lab.com>
Cc: Paolo Abeni <pabeni@...hat.com>,
Matthew Dawson <matthew@...systems.ca>,
Network Development <netdev@...r.kernel.org>,
"Macieira, Thiago" <thiago.macieira@...el.com>
Subject: Re: [PATCH net] datagram: When peeking datagrams with offset < 0
don't skip empty skbs
On Thu, Aug 17, 2017 at 5:15 AM, David Laight <David.Laight@...lab.com> wrote:
> From: Willem de Bruijn
>> Sent: 17 August 2017 00:27
>> Actually, it is safe even without the check. Overflow of the signed integer
>> is benign here.
>
> IIRC the C language states that 'signed integer overflow' is undefined.
> So 'MAXINT + 1' doesn't have to equal '-MAXINT - 1' (as one would
> expect on a 2's compliment system).
>
> While the linux kernel probably won't run on systems where this isn't true
> (eg where signed arithmetic saturates) gcc will assume it can't happen
> and optimise code with that assumption.
Ah, of course. Thanks. The last patch does not rely on such tricks, indeed.
On rereading, it is actually very similar to Matthew's original. The
main difference is handling the negative offset case inside
__skb_try_recv_from_queue instead of in each caller.
Powered by blists - more mailing lists