Message ID | 49e20da5d467a73414d4294a8bd35e2cb1befd49.1604308087.git.dcaratti@redhat.com |
---|---|
State | Accepted |
Delegated to: | David Miller |
Headers | show |
Series | [net] mptcp: token: fix unititialized variable | expand |
Context | Check | Description |
---|---|---|
jkicinski/patch_count | success | Link |
jkicinski/cover_letter | success | Link |
jkicinski/fixes_present | success | Link |
jkicinski/tree_selection | success | Clearly marked for net |
jkicinski/subject_prefix | success | Link |
jkicinski/source_inline | success | Was 0 now: 0 |
jkicinski/verify_signedoff | success | Link |
jkicinski/module_param | success | Was 0 now: 0 |
jkicinski/build_32bit | success | Errors and warnings before: 1 this patch: 1 |
jkicinski/kdoc | success | Errors and warnings before: 0 this patch: 0 |
jkicinski/verify_fixes | success | Link |
jkicinski/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 8 lines checked |
jkicinski/build_allmodconfig_warn | success | Errors and warnings before: 1 this patch: 1 |
jkicinski/header_inline | success | Link |
jkicinski/stable | success | Stable not CCed |
On Mon, 2020-11-02 at 10:09 +0100, Davide Caratti wrote: > gcc complains about use of uninitialized 'num'. Fix it by doing the first > assignment of 'num' when the variable is declared. > > Fixes: 96d890daad05 ("mptcp: add msk interations helper") > Signed-off-by: Davide Caratti <dcaratti@redhat.com> > --- > net/mptcp/token.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/mptcp/token.c b/net/mptcp/token.c > index 8b47c4bb1c6b..feb4b9ffd462 100644 > --- a/net/mptcp/token.c > +++ b/net/mptcp/token.c > @@ -291,7 +291,7 @@ struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot, > { > struct mptcp_sock *ret = NULL; > struct hlist_nulls_node *pos; > - int slot, num; > + int slot, num = 0; > > for (slot = *s_slot; slot <= token_mask; *s_num = 0, slot++) { > struct token_bucket *bucket = &token_hash[slot]; LGTM, thanks Davide! Acked-by: Paolo Abeni <pabeni@redhat.com>
On Mon, 02 Nov 2020 11:48:25 +0100 Paolo Abeni wrote: > On Mon, 2020-11-02 at 10:09 +0100, Davide Caratti wrote: > > gcc complains about use of uninitialized 'num'. Fix it by doing the first > > assignment of 'num' when the variable is declared. > > > > Fixes: 96d890daad05 ("mptcp: add msk interations helper") > > Signed-off-by: Davide Caratti <dcaratti@redhat.com> > > Acked-by: Paolo Abeni <pabeni@redhat.com> Applied, thanks!
diff --git a/net/mptcp/token.c b/net/mptcp/token.c index 8b47c4bb1c6b..feb4b9ffd462 100644 --- a/net/mptcp/token.c +++ b/net/mptcp/token.c @@ -291,7 +291,7 @@ struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot, { struct mptcp_sock *ret = NULL; struct hlist_nulls_node *pos; - int slot, num; + int slot, num = 0; for (slot = *s_slot; slot <= token_mask; *s_num = 0, slot++) { struct token_bucket *bucket = &token_hash[slot];
gcc complains about use of uninitialized 'num'. Fix it by doing the first assignment of 'num' when the variable is declared. Fixes: 96d890daad05 ("mptcp: add msk interations helper") Signed-off-by: Davide Caratti <dcaratti@redhat.com> --- net/mptcp/token.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)