From patchwork Fri May 15 15:52:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 472852 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2869E140B0E for ; Sat, 16 May 2015 01:52:28 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=BOUkUu5r; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934766AbbEOPwZ (ORCPT ); Fri, 15 May 2015 11:52:25 -0400 Received: from mail-ig0-f173.google.com ([209.85.213.173]:37031 "EHLO mail-ig0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934569AbbEOPwW (ORCPT ); Fri, 15 May 2015 11:52:22 -0400 Received: by igbsb11 with SMTP id sb11so132817287igb.0 for ; Fri, 15 May 2015 08:52:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:content-type:mime-version :content-transfer-encoding; bh=cU2OE21bLypiA+nT2JXfh3oSoMLcUGd+hqQZ0R0aRos=; b=BOUkUu5rbDmD55NK621cVq+Rzv4HQqYVm0Rcowa4dJ/Ehnd5RkG3yAwo+ZGYLQ5gTQ PycDzsPc1tPFH25IJ0enrv6efV4CA7OG2gIvruOsLr1t9aVX2QEmDYUDQ5swzZGd8f7U E4dbC9txUQS6+a2GcjCbQE7igD9Md7hDNiwnF5vMLtDbWanUXOCT/aG7PcYRrUMVcTtt /KaM4iQSGQjg2yNceUpLvhTyFfG1dKXAEEqJUJPkdvr27cJfslWfk/cfeMddhCcZSw1z pKVJie0jD3PMJprfU+LqkiPUigw6M/lK9wCUDBuOVjRb1RfngjU72qn23wrQXr+Ku5Y5 gN6A== X-Received: by 10.107.37.211 with SMTP id l202mr13945086iol.76.1431705141791; Fri, 15 May 2015 08:52:21 -0700 (PDT) Received: from [172.26.50.100] ([172.26.50.100]) by mx.google.com with ESMTPSA id v14sm1630165igd.12.2015.05.15.08.52.20 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Fri, 15 May 2015 08:52:21 -0700 (PDT) Message-ID: <1431705139.27831.106.camel@edumazet-glaptop2.roam.corp.google.com> Subject: [PATCH net-next] net: fix sparse error in csum_replace4() From: Eric Dumazet To: David Miller Cc: netdev Date: Fri, 15 May 2015 08:52:19 -0700 X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet make C=2 CF=-D__CHECK_ENDIAN__ net/ipv4/netfilter/nf_nat_l3proto_ipv4.o CHECK net/ipv4/netfilter/nf_nat_l3proto_ipv4.c include/net/checksum.h:125:64: warning: incorrect type in argument 2 (different base types) include/net/checksum.h:125:64: expected restricted __wsum [usertype] addend include/net/checksum.h:125:64: got restricted __be32 [usertype] from include/net/checksum.h:125:71: warning: incorrect type in argument 2 (different base types) include/net/checksum.h:125:71: expected restricted __wsum [usertype] addend include/net/checksum.h:125:71: got restricted __be32 [usertype] to include/net/checksum.h:125:64: warning: incorrect type in argument 2 (different base types) include/net/checksum.h:125:64: expected restricted __wsum [usertype] addend include/net/checksum.h:125:64: got restricted __be32 [usertype] from include/net/checksum.h:125:71: warning: incorrect type in argument 2 (different base types) include/net/checksum.h:125:71: expected restricted __wsum [usertype] addend include/net/checksum.h:125:71: got restricted __be32 [usertype] to Fixes: 4565af0d406b ("net: optimise csum_replace4()") Signed-off-by: Eric Dumazet --- include/net/checksum.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/net/checksum.h b/include/net/checksum.h index 0a55ac715077d0aad820916f9daf979ae3dfd0fd..2d1d73cb773e9bd160f5c43bb58981ee8597b87c 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h @@ -122,7 +122,9 @@ static inline __wsum csum_partial_ext(const void *buff, int len, __wsum sum) static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) { - *sum = csum_fold(csum_add(csum_sub(~csum_unfold(*sum), from), to)); + __wsum tmp = csum_sub(~csum_unfold(*sum), (__force __wsum)from); + + *sum = csum_fold(csum_add(tmp, (__force __wsum)to)); } /* Implements RFC 1624 (Incremental Internet Checksum)