diff mbox series

mptcp: Remove redundant assignment to remaining

Message ID 1623754538-85616-1-git-send-email-jiapeng.chong@linux.alibaba.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series mptcp: Remove redundant assignment to remaining | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers warning 3 maintainers not CCed: nathan@kernel.org ndesaulniers@google.com clang-built-linux@googlegroups.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link

Commit Message

Jiapeng Chong June 15, 2021, 10:55 a.m. UTC
Variable remaining is assigned, but this value is never read as it is
not used later on, hence it is a redundant assignment and can be
removed.

Clean up the following clang-analyzer warning:

net/mptcp/options.c:779:3: warning: Value stored to 'remaining' is never
read [clang-analyzer-deadcode.DeadStores].

net/mptcp/options.c:547:3: warning: Value stored to 'remaining' is never
read [clang-analyzer-deadcode.DeadStores].

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 net/mptcp/options.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Mat Martineau June 15, 2021, 11:52 p.m. UTC | #1
On Tue, 15 Jun 2021, Jiapeng Chong wrote:

> Variable remaining is assigned, but this value is never read as it is
> not used later on, hence it is a redundant assignment and can be
> removed.
>
> Clean up the following clang-analyzer warning:
>
> net/mptcp/options.c:779:3: warning: Value stored to 'remaining' is never
> read [clang-analyzer-deadcode.DeadStores].
>
> net/mptcp/options.c:547:3: warning: Value stored to 'remaining' is never
> read [clang-analyzer-deadcode.DeadStores].
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
> net/mptcp/options.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index 9b263f2..f99272f 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -544,7 +544,6 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
>
> 		map_size = TCPOLEN_MPTCP_DSS_BASE + TCPOLEN_MPTCP_DSS_MAP64;
>
> -		remaining -= map_size;

Hi Jiapeng, thank you for your MPTCP patch!

This change in mptcp_established_options_dss() removes the only reference 
to 'remaining' in that function, so the variable should also be removed 
from the function parameters. It also appears to be unused in 
mptcp_established_options_mp().

I'd like to handle this patch through the MPTCP tree so we can manage 
conflicts with other in-progress patches. This patch does apply to 
net-next cleanly but not our subsystem branch. You can find our git repo 
at https://github.com/multipath-tcp/mptcp_net-next, and develop patches 
using the 'export' branch. If you email a v2 patch to 
mptcp@lists.linux.dev (no need to cc other lists), Matthieu and I can make 
sure it is integrated in the MPTCP repository and handle sending it to 
netdev along with other patches from the MPTCP community.

> 		dss_size = map_size;
> 		if (mpext)
> 			opts->ext_copy = *mpext;
> @@ -776,7 +775,6 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
>
> 	if (mptcp_established_options_mp_prio(sk, &opt_size, remaining, opts)) {
> 		*size += opt_size;
> -		remaining -= opt_size;
> 		ret = true;
> 	}
>
> -- 
> 1.8.3.1

Best regards,

--
Mat Martineau
Intel
diff mbox series

Patch

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 9b263f2..f99272f 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -544,7 +544,6 @@  static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
 
 		map_size = TCPOLEN_MPTCP_DSS_BASE + TCPOLEN_MPTCP_DSS_MAP64;
 
-		remaining -= map_size;
 		dss_size = map_size;
 		if (mpext)
 			opts->ext_copy = *mpext;
@@ -776,7 +775,6 @@  bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
 
 	if (mptcp_established_options_mp_prio(sk, &opt_size, remaining, opts)) {
 		*size += opt_size;
-		remaining -= opt_size;
 		ret = true;
 	}