net/netfilter/xt_ipcomp.c:63:26: sparse: restricted __be16 degrades to integer
net/netfilter/xt_ipcomp.c:63:26: sparse: cast to restricted __be32
Fix this by using 16bits long spi, as IPcomp CPI is only valid for 16bits.
Signed-off-by: Fan Du <redacted>
---
include/uapi/linux/netfilter/xt_ipcomp.h | 2 +-
net/netfilter/xt_ipcomp.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
@@ -4,7 +4,7 @@#include<linux/types.h>structxt_ipcomp{-__u32spis[2];/* Security Parameter Index */+__u16spis[2];/* Security Parameter Index */__u8invflags;/* Inverse flags */__u8hdrres;/* Test of the Reserved Filed */};
From: Pablo Neira Ayuso <pablo@netfilter.org> Date: 2014-01-18 12:24:53
On Sat, Jan 18, 2014 at 10:16:14AM +0800, Fan Du wrote:
quoted hunk
sparse warnings: (new ones prefixed by >>)
quoted
quoted
quoted
quoted
net/netfilter/xt_ipcomp.c:63:26: sparse: restricted __be16 degrades to integer
net/netfilter/xt_ipcomp.c:63:26: sparse: cast to restricted __be32
Fix this by using 16bits long spi, as IPcomp CPI is only valid for 16bits.
Signed-off-by: Fan Du <redacted>
---
include/uapi/linux/netfilter/xt_ipcomp.h | 2 +-
net/netfilter/xt_ipcomp.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
@@ -4,7 +4,7 @@#include<linux/types.h>structxt_ipcomp{-__u32spis[2];/* Security Parameter Index */+__u16spis[2];/* Security Parameter Index */
This changes the binary interface so it break userspace (iptables
needs to be recompiled), we're still in time to make such change as
this is net-next stuff, but what I understand from the patch
description is that this aims to fix a sparse warning, which is a bit
of intrusive change.
Didn't you find any way to fix this without change the layout of
xt_ipcomp?
quoted hunk
__u8 invflags; /* Inverse flags */
__u8 hdrres; /* Test of the Reserved Filed */
};
On Sat, Jan 18, 2014 at 10:16:14AM +0800, Fan Du wrote:
quoted
quoted
sparse warnings: (new ones prefixed by>>)
quoted
quoted
quoted
quoted
>> >> net/netfilter/xt_ipcomp.c:63:26: sparse: restricted __be16 degrades to integer
>> >> net/netfilter/xt_ipcomp.c:63:26: sparse: cast to restricted __be32
Fix this by using 16bits long spi, as IPcomp CPI is only valid for 16bits.
Signed-off-by: Fan Du[off-list ref]
---
include/uapi/linux/netfilter/xt_ipcomp.h | 2 +-
net/netfilter/xt_ipcomp.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/uapi/linux/netfilter/xt_ipcomp.h b/include/uapi/linux/netfilter/xt_ipcomp.h
index 45c7e40..ca82ebb 100644
--- a/include/uapi/linux/netfilter/xt_ipcomp.h
+++ b/include/uapi/linux/netfilter/xt_ipcomp.h
@@ -4,7 +4,7 @@
#include<linux/types.h>
struct xt_ipcomp {
- __u32 spis[2]; /* Security Parameter Index */
+ __u16 spis[2]; /* Security Parameter Index */
This changes the binary interface so it break userspace (iptables
needs to be recompiled), we're still in time to make such change as
this is net-next stuff, but what I understand from the patch
description is that this aims to fix a sparse warning, which is a bit
of intrusive change.
Didn't you find any way to fix this without change the layout of
xt_ipcomp?
My bad for not catching this in the initial ipcomp version.
It would be easier to just use ntohs here to ease sparse checking.
From dbf796e63d600256fd40000669b83227ddccebc4 Mon Sep 17 00:00:00 2001
From: Fan Du <redacted>
Date: Mon, 20 Jan 2014 09:42:12 +0800
Subject: [PATCHv2 net-next] ipcomp: Use ntohs to ease sparse warning
0-DAY kernel build testing backend reported:
sparse warnings: (new ones prefixed by >>)
>> >> net/netfilter/xt_ipcomp.c:63:26: sparse: restricted __be16 degrades to integer
>> >> net/netfilter/xt_ipcomp.c:63:26: sparse: cast to restricted __be32
Fix this by using ntohs without shifting.
Tested with: make C=1 CF=-D__CHECK_ENDIAN__
Signed-off-by: Fan Du <redacted>
---
net/netfilter/xt_ipcomp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Pablo Neira Ayuso <pablo@netfilter.org> Date: 2014-02-19 10:14:13
On Mon, Jan 20, 2014 at 09:55:42AM +0800, Fan Du wrote:
On 2014年01月18日 20:24, Pablo Neira Ayuso wrote:
quoted
Didn't you find any way to fix this without change the layout of
xt_ipcomp?
My bad for not catching this in the initial ipcomp version.
It would be easier to just use ntohs here to ease sparse checking.
From dbf796e63d600256fd40000669b83227ddccebc4 Mon Sep 17 00:00:00 2001
From: Fan Du <redacted>
Date: Mon, 20 Jan 2014 09:42:12 +0800
Subject: [PATCHv2 net-next] ipcomp: Use ntohs to ease sparse warning
0-DAY kernel build testing backend reported:
sparse warnings: (new ones prefixed by >>)
quoted
quoted
quoted
quoted
net/netfilter/xt_ipcomp.c:63:26: sparse: restricted __be16 degrades to integer
net/netfilter/xt_ipcomp.c:63:26: sparse: cast to restricted __be32
Fix this by using ntohs without shifting.
Tested with: make C=1 CF=-D__CHECK_ENDIAN__