Skip to contentSkip to conversation

mptcp sparse "fixes"

PATCH In review Florian Westphal 3 participants 7 messages Sep 9, 2019 – Sep 21, 2019

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author
#0 lore raw

cover mptcp sparse "fixes"

NB: these patches don't fix anything because nothing is broken.

The "sparse" checker complains about various constructs, this fixes some of those. All of these can be squashed, I've placed the name of the target commit in the change logs.

There are more sparse warnings in the code base, I am intentionally skipping those for now as its in code that is still "in flux".

For example the icsk ulp data pointer now has an __rcu annotation upstream so sparse complains because we don't use rcu_dereference() or similar.

In any case, I think those can be fixed once the code has stabilized more. I am sending these now because they are in more "mature" areas and it reduces the delta between my working tree and the "export" branch.

Thanks,
Florian

 crypto.c   |    2 ++
 options.c  |    4 ++--
 pm.c       |    2 +-
 protocol.h |    2 +-
 4 files changed, 6 insertions(+), 4 deletions(-)
author
#1 lore raw

PATCH 1/4 protocol: avoid sparse endian warning

protocol.h:82:16: warning: incorrect type in return expression (different base types)
protocol.h:82:16: expected unsigned int
protocol.h:82:16: got restricted __be32 [usertype]

squashto: mptcp: Add ADD_ADDR handling

Signed-off-by Florian Westphal <fw(a)strlen.de>
---
 net/mptcp/protocol.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/mptcp/protocol.h +1 -1
index bd7b3b107fe0..49ac7c842a3c 100644
@@ -77,7 +77,7 @@
 /* MPTCP socket flags */
 #define MPTCP_DATA_READY	BIT(0)
 
-static inline u32 mptcp_option(u8 subopt, u8 len, u8 nib, u8 field)
+static inline __be32 mptcp_option(u8 subopt, u8 len, u8 nib, u8 field)
 {
 	return htonl((TCPOPT_MPTCP << 24) | (len << 16) | (subopt << 12) |
 		     ((nib & 0xF) << 8) | field);
Signature · 1 line
2.21.0
author
#2 lore raw

PATCH 2/4 options: fix __sum16 degrades to integer sparse warning

In reply to Florian Westphal

options.c:714:42: warning: incorrect type in assignment (different base types)
options.c:714:42: expected restricted __sum16 [assigned] [usertype] checksum
options.c:714:42: got int
options.c:715:32: warning: restricted __sum16 degrades to integer options.c:715:32: warning: restricted __sum16 degrades to integer

squashto: mptcp: Write MPTCP DSS headers to outgoing data packets

Signed-off-by Florian Westphal <fw(a)strlen.de>
---
 net/mptcp/options.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/mptcp/options.c +2 -2
index b82557af3fae..1645006d59c4 100644
@@ -701,7 +701,7 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts)
 		}
 
 		if (mpext->use_map) {
-			__sum16 checksum;
+			__u16 checksum;
 
 			pr_debug("Writing map values");
 			put_unaligned_be64(mpext->data_seq, ptr);
@@ -709,7 +709,7 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts)
 			*ptr++ = htonl(mpext->subflow_seq);
 
 			if (mpext->use_checksum)
-				checksum = mpext->checksum;
+				checksum = (u16 __force)mpext->checksum;
 			else
 				checksum = TCPOPT_NOP << 8 | TCPOPT_NOP;
 			*ptr = htonl(mpext->data_len << 16 | checksum);
Signature · 1 line
2.21.0
author
#3 lore raw

PATCH 3/4 crypto: include protocol.h to get function prototypes

In reply to Florian Westphal

crypto.c:29:6: warning: symbol 'crypto_key_sha1' was not declared. Should it be static? crypto.c:54:6: warning: symbol 'crypto_hmac_sha1' was not declared. Should it be static?

squashto: mptcp: Add key generation and token tree

Signed-off-by Florian Westphal <fw(a)strlen.de>
---
 net/mptcp/crypto.c | 2 ++
 1 file changed, 2 insertions(+)
net/mptcp/crypto.c +2 -0
index 8b67b11e626c..2cd988b9a312 100644
@@ -26,6 +26,8 @@
 #include <linux/siphash.h>
 #include <asm/unaligned.h>
 
+#include "protocol.h"
+
 void crypto_key_sha1(u64 key, u32 *token, u64 *idsn)
 {
 	u32 workspace[SHA_WORKSPACE_WORDS];
Signature · 1 line
2.21.0
author
#4 lore raw

PATCH 4/4 pm: avoid endianness conversion warning

In reply to Florian Westphal

pm.c:72:31: warning: incorrect type in assignment (different base types)
pm.c:72:31: expected restricted __be32 [assigned] [usertype] s_addr
pm.c:72:31: got unsigned long

squashto: mptcp: Implement path manager interface commands

Signed-off-by Florian Westphal <fw(a)strlen.de>
---
 net/mptcp/pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/mptcp/pm.c +1 -1
index 57e13837ee22..c8d6341c9683 100644
@@ -69,7 +69,7 @@ int pm_create_subflow(u32 token, u8 remote_id)
 
 	local.sin_family = AF_INET;
 	local.sin_port = 0;
-	local.sin_addr.s_addr = INADDR_ANY;
+	local.sin_addr.s_addr = htonl(INADDR_ANY);
 
 	remote.sin_family = msk->pm.remote_family;
 	remote.sin_port = htons(msk->dport);
Signature · 1 line
2.21.0
#5 lore raw
In reply to Florian Westphal

Hi Florian -

This all looks good to me, thanks.

Peter.

Quoted 30 lines · Florian Westphal

NB: these patches don't fix anything because nothing is broken.

The "sparse" checker complains about various constructs, this fixes some of those. All of these can be squashed, I've placed the name of the target commit in the change logs.

There are more sparse warnings in the code base, I am intentionally skipping those for now as its in code that is still "in flux".

For example the icsk ulp data pointer now has an __rcu annotation upstream so sparse complains because we don't use rcu_dereference() or similar.

In any case, I think those can be fixed once the code has stabilized more. I am sending these now because they are in more "mature" areas and it reduces the delta between my working tree and the "export" branch.

Thanks,
Florian

 crypto.c   |    2 ++
 options.c  |    4 ++--
 pm.c       |    2 +-
 protocol.h |    2 +-
 4 files changed, 6 insertions(+), 4 deletions(-)

_______________________________________________
mptcp mailing list
mptcp(a)lists.01.org
https://lists.01.org/mailman/listinfo/mptcp

#6 lore raw

Hi Florian, Peter,

Quoted 23 lines · Peter Krystad

Hi Florian -

This all looks good to me, thanks.

Peter.

Quoted 15 lines · Florian Westphal

NB: these patches don't fix anything because nothing is broken.

The "sparse" checker complains about various constructs, this fixes some of those. All of these can be squashed, I've placed the name of the target commit in the change logs.

There are more sparse warnings in the code base, I am intentionally skipping those for now as its in code that is still "in flux".

For example the icsk ulp data pointer now has an __rcu annotation upstream so sparse complains because we don't use rcu_dereference() or similar.

In any case, I think those can be fixed once the code has stabilized more. I am sending these now because they are in more "mature" areas and it reduces the delta between my working tree and the "export" branch.

Thank you for the patches and the reviews!

- ca9e24a3fc4b: "squashed" the 1st one in "mptcp: Add ADD_ADDR handling"
- 8e734cf08528: conflict in t/mptcp-Make-MPTCP-socket-block-wakeup-ignore-sk_receive_queue
- signed-off was already there
- 0341ab0068b3..9281f9e12829: result
- f89dfa25b401: "squashed" the 2nd one in "mptcp: Write MPTCP DSS headers to outgoing data packets"
- b93110fbba4a: add signed-off
- 9281f9e12829..e27f63c56155: result
- 22387add4faa: "squashed" the 3rd one in "mptcp: Add key generation and token tree"
- signed-off was already there
- e27f63c56155..f51ca08dd4f3: result
- e0ce97687b36: "squashed" in "mptcp: Implement path manager interface commands"
- cbb100c6570d: signed-off
- f51ca08dd4f3..4c186ad4f312: result

Tests are running now but I guess everything should still be OK!

Cheers,
Matt

Signature · 5 lines
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium