netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] mptcp: token: fix unititialized variable
@ 2020-11-02  9:09 Davide Caratti
  2020-11-02 10:48 ` Paolo Abeni
  0 siblings, 1 reply; 3+ messages in thread
From: Davide Caratti @ 2020-11-02  9:09 UTC (permalink / raw)
  To: mptcp, netdev; +Cc: Jakub Kicinski

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];
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] mptcp: token: fix unititialized variable
  2020-11-02  9:09 [PATCH net] mptcp: token: fix unititialized variable Davide Caratti
@ 2020-11-02 10:48 ` Paolo Abeni
  2020-11-03 21:10   ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Abeni @ 2020-11-02 10:48 UTC (permalink / raw)
  To: Davide Caratti, mptcp, netdev; +Cc: Jakub Kicinski

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>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] mptcp: token: fix unititialized variable
  2020-11-02 10:48 ` Paolo Abeni
@ 2020-11-03 21:10   ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2020-11-03 21:10 UTC (permalink / raw)
  To: Paolo Abeni; +Cc: Davide Caratti, mptcp, netdev

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!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-03 21:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-02  9:09 [PATCH net] mptcp: token: fix unititialized variable Davide Caratti
2020-11-02 10:48 ` Paolo Abeni
2020-11-03 21:10   ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).