android_kernel_xiaomi_sm8350/include
Gerrit Renker 9a036b9c33 [TCP]: Fix ambiguity in the `before' relation.
While looking at DCCP sequence numbers, I stumbled over a problem with
the following definition of before in tcp.h:

static inline int before(__u32 seq1, __u32 seq2)
{
        return (__s32)(seq1-seq2) < 0;
}

Problem: This definition suffers from an an ambiguity, i.e. always

           before(a, (a + 2^31) % 2^32)) = 1
           before((a + 2^31) % 2^32), a) = 1

         In text: when the difference between a and b amounts to 2^31,
         a is always considered `before' b, the function can not decide.
         The reason is that implicitly 0 is `before' 1 ... 2^31-1 ... 2^31

Solution: There is a simple fix, by defining before in such a way that
          0 is no longer `before' 2^31, i.e. 0 `before' 1 ... 2^31-1
          By not using the middle between 0 and 2^32, before can be made
          unambiguous.
          This is achieved by testing whether seq2-seq1 > 0 (using signed
          32-bit arithmetic).

I attach a patch to codify this. Also the `after' relation is basically
a redefinition of `before', it is now defined as a macro after before.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-12-22 11:12:01 -08:00
..
acpi
asm-alpha [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-arm [ARM] 4057/1: ixp23xx: unconditionally enable hardware coherency 2006-12-18 00:14:59 +00:00
asm-arm26 [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-avr32 [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-cris [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-frv [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-generic PCI: Fix multiple problems with VIA hardware 2006-12-20 10:54:43 -08:00
asm-h8300 [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-i386 [PATCH] compile error of register_memory() 2006-12-22 08:55:49 -08:00
asm-ia64 Merge branch 'release' of master.kernel.org:/home/ftp/pub/scm/linux/kernel/git/aegl/linux-2.6 2006-12-13 15:57:58 -08:00
asm-m32r [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-m68k [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-m68knommu [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-mips [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-parisc [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-powerpc [POWERPC] cell: add forward struct declarations to spu.h 2006-12-19 15:35:36 +01:00
asm-ppc Merge branch 'for_paulus' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc 2006-12-11 16:31:42 +11:00
asm-s390 [S390] Fix reboot hang on LPARs 2006-12-15 17:18:22 +01:00
asm-sh [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-sh64 [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-sparc [SPARC]: Make bitops use same spinlocks as atomics. 2006-12-17 16:18:47 -08:00
asm-sparc64 [SPARC64]: Mirror x86_64's PERCPU_ENOUGH_ROOM definition. 2006-12-17 14:06:59 -08:00
asm-um
asm-v850 [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
asm-x86_64 Remove stack unwinder for now 2006-12-15 08:47:51 -08:00
asm-xtensa [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
crypto
keys
linux [PATCH] mips: if_fddi.h: Add a missing inclusion 2006-12-22 08:55:50 -08:00
math-emu
media
mtd
net [TCP]: Fix ambiguity in the `before' relation. 2006-12-22 11:12:01 -08:00
pcmcia
rdma IB: Fix ib_dma_alloc_coherent() wrapper 2006-12-15 13:57:26 -08:00
rxrpc
scsi
sound [ALSA] version 1.0.14rc1 2006-12-20 09:11:55 +01:00
video [PATCH] sstfb: add sysfs interface 2006-12-13 09:05:55 -08:00
Kbuild