Thread (31 messages) 31 messages, 5 authors, 2017-08-17

Re: [PATCH net] datagram: When peeking datagrams with offset < 0 don't skip empty skbs

flat view

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: 2017-08-17 14:38:13

On Thu, Aug 17, 2017 at 5:15 AM, David Laight [off-list ref] wrote:
From: Willem de Bruijn
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help