From: Bob Breuer <breuerr@mc.net>
Date: Fri, 2 Feb 2007 04:24:35 +0000 (-0800)
Subject: [SPARC32]: Fix over-optimization by GCC near ip_fast_csum.
X-Git-Tag: firefly_0821_release~31349^2
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=51bcf092917bfaa88d762879d0bbfe7619e8c16c;p=firefly-linux-kernel-4.4.55.git

[SPARC32]: Fix over-optimization by GCC near ip_fast_csum.

In some cases such as:
	iph->check = 0;
	iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
GCC may optimize out the previous store.

Observed as a failure of NFS over udp (bad checksums on ip fragments)
when compiled with GCC 3.4.2.

Signed-off-by: Bob Breuer <breuerr@mc.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
---

diff --git a/include/asm-sparc/checksum.h b/include/asm-sparc/checksum.h
index 267e631e9bbc..34518ea7bf1b 100644
--- a/include/asm-sparc/checksum.h
+++ b/include/asm-sparc/checksum.h
@@ -151,7 +151,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
 			     "xnor\t%%g0, %0, %0"
 			     : "=r" (sum), "=&r" (iph)
 			     : "r" (ihl), "1" (iph)
-			     : "g2", "g3", "g4", "cc");
+			     : "g2", "g3", "g4", "cc", "memory");
 	return sum;
 }