Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1647131 > unrolled thread

[PATCH 0/5] net-SCTP: Adjustments for three function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-05-22 18:40 +0200
Last post2017-05-23 08:40 +0200
Articles 20 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/5] net-SCTP: Adjustments for three function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-22 18:40 +0200
    [PATCH 1/5] sctp: Use kmalloc_array() in sctp_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-22 18:40 +0200
      Re: [PATCH 1/5] sctp: Use kmalloc_array() in sctp_init() Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2017-05-22 22:00 +0200
      Re: [PATCH 1/5] sctp: Use kmalloc_array() in sctp_init() Vlad Yasevich <vyasevic@redhat.com> - 2017-05-22 23:00 +0200
    [PATCH 2/5] sctp: Delete an error message for a failed memory  allocation in sctp_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-22 18:40 +0200
      Re: [PATCH 2/5] sctp: Delete an error message for a failed memory  allocation in sctp_init() Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2017-05-22 19:00 +0200
        Re: [PATCH 2/5] sctp: Delete an error message for a failed memory  allocation in sctp_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-22 21:50 +0200
          Re: [PATCH 2/5] sctp: Delete an error message for a failed memory  allocation in sctp_init() Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2017-05-22 22:00 +0200
      Re: [PATCH 2/5] sctp: Delete an error message for a failed memory  allocation in sctp_init() Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2017-05-22 22:00 +0200
      Re: [PATCH 2/5] sctp: Delete an error message for a failed memory  allocation in sctp_init() Vlad Yasevich <vyasevic@redhat.com> - 2017-05-22 23:00 +0200
    [PATCH 5/5] sctp: Adjust one function call together with a variable  assignment SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-22 18:50 +0200
      Re: [PATCH 5/5] sctp: Adjust one function call together with a  variable assignment Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2017-05-22 22:00 +0200
      Re: [PATCH 5/5] sctp: Adjust one function call together with a  variable assignment Vlad Yasevich <vyasevic@redhat.com> - 2017-05-22 23:10 +0200
    [PATCH 3/5] sctp: Fix a typo in a comment line in sctp_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-22 18:50 +0200
      Re: [PATCH 3/5] sctp: Fix a typo in a comment line in sctp_init() Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2017-05-22 22:00 +0200
      Re: [PATCH 3/5] sctp: Fix a typo in a comment line in sctp_init() Vlad Yasevich <vyasevic@redhat.com> - 2017-05-22 23:10 +0200
    [PATCH 4/5] sctp: Improve a size determination in  sctp_inetaddr_event() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-22 18:50 +0200
      Re: [PATCH 4/5] sctp: Improve a size determination in  sctp_inetaddr_event() Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2017-05-22 22:00 +0200
      Re: [PATCH 4/5] sctp: Improve a size determination in  sctp_inetaddr_event() Vlad Yasevich <vyasevic@redhat.com> - 2017-05-22 23:10 +0200
    Re: [PATCH 0/5] net-SCTP: Adjustments for three function implementations Xin Long <lucien.xin@gmail.com> - 2017-05-23 08:40 +0200

#1647131 — [PATCH 0/5] net-SCTP: Adjustments for three function implementations

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-22 18:40 +0200
Subject[PATCH 0/5] net-SCTP: Adjustments for three function implementations
Message-ID<tJYxb-83k-11@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 22 May 2017 18:30:45 +0200

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (5):
  Use kmalloc_array() in sctp_init()
  Delete an error message for a failed memory allocation in sctp_init()
  Fix a typo in a comment line in sctp_init()
  Improve a size determination in sctp_inetaddr_event()
  Adjust one function call together with a variable assignment

 net/sctp/protocol.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

-- 
2.13.0

[toc] | [next] | [standalone]


#1647134 — [PATCH 1/5] sctp: Use kmalloc_array() in sctp_init()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-22 18:40 +0200
Subject[PATCH 1/5] sctp: Use kmalloc_array() in sctp_init()
Message-ID<tJYxb-83k-17@gated-at.bofh.it>
In reply to#1647131
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 22 May 2017 17:20:11 +0200

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "kmalloc_array".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data structure by a pointer dereference
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 net/sctp/protocol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 989a900383b5..2b1a6215bd2f 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1442,6 +1442,6 @@ static __init int sctp_init(void)
 
 	/* Allocate and initialize the endpoint hash table.  */
 	sctp_ep_hashsize = 64;
-	sctp_ep_hashtable =
-		kmalloc(64 * sizeof(struct sctp_hashbucket), GFP_KERNEL);
+	sctp_ep_hashtable = kmalloc_array(64, sizeof(*sctp_ep_hashtable),
+					  GFP_KERNEL);
 	if (!sctp_ep_hashtable) {
-- 
2.13.0

[toc] | [prev] | [next] | [standalone]


#1647320 — Re: [PATCH 1/5] sctp: Use kmalloc_array() in sctp_init()

FromMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date2017-05-22 22:00 +0200
SubjectRe: [PATCH 1/5] sctp: Use kmalloc_array() in sctp_init()
Message-ID<tK1EK-1rk-13@gated-at.bofh.it>
In reply to#1647134
On Mon, May 22, 2017 at 06:37:19PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 22 May 2017 17:20:11 +0200
> 
> * A multiplication for the size determination of a memory allocation
>   indicated that an array data structure should be processed.
>   Thus use the corresponding function "kmalloc_array".
> 
>   This issue was detected by using the Coccinelle software.
> 
> * Replace the specification of a data structure by a pointer dereference
>   to make the corresponding size determination a bit safer according to
>   the Linux coding style convention.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

> ---
>  net/sctp/protocol.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
> index 989a900383b5..2b1a6215bd2f 100644
> --- a/net/sctp/protocol.c
> +++ b/net/sctp/protocol.c
> @@ -1442,6 +1442,6 @@ static __init int sctp_init(void)
>  
>  	/* Allocate and initialize the endpoint hash table.  */
>  	sctp_ep_hashsize = 64;
> -	sctp_ep_hashtable =
> -		kmalloc(64 * sizeof(struct sctp_hashbucket), GFP_KERNEL);
> +	sctp_ep_hashtable = kmalloc_array(64, sizeof(*sctp_ep_hashtable),
> +					  GFP_KERNEL);
>  	if (!sctp_ep_hashtable) {
> -- 
> 2.13.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [next] | [standalone]


#1647377 — Re: [PATCH 1/5] sctp: Use kmalloc_array() in sctp_init()

FromVlad Yasevich <vyasevic@redhat.com>
Date2017-05-22 23:00 +0200
SubjectRe: [PATCH 1/5] sctp: Use kmalloc_array() in sctp_init()
Message-ID<tK2AO-1ZI-7@gated-at.bofh.it>
In reply to#1647134
On 05/22/2017 12:37 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 22 May 2017 17:20:11 +0200
> 
> * A multiplication for the size determination of a memory allocation
>   indicated that an array data structure should be processed.
>   Thus use the corresponding function "kmalloc_array".
> 
>   This issue was detected by using the Coccinelle software.
> 
> * Replace the specification of a data structure by a pointer dereference
>   to make the corresponding size determination a bit safer according to
>   the Linux coding style convention.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Vlad Yasevich <vyasevich@gmail.com>

-vlad

> ---
>  net/sctp/protocol.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
> index 989a900383b5..2b1a6215bd2f 100644
> --- a/net/sctp/protocol.c
> +++ b/net/sctp/protocol.c
> @@ -1442,6 +1442,6 @@ static __init int sctp_init(void)
>  
>  	/* Allocate and initialize the endpoint hash table.  */
>  	sctp_ep_hashsize = 64;
> -	sctp_ep_hashtable =
> -		kmalloc(64 * sizeof(struct sctp_hashbucket), GFP_KERNEL);
> +	sctp_ep_hashtable = kmalloc_array(64, sizeof(*sctp_ep_hashtable),
> +					  GFP_KERNEL);
>  	if (!sctp_ep_hashtable) {
> 

[toc] | [prev] | [next] | [standalone]


#1647139 — [PATCH 2/5] sctp: Delete an error message for a failed memory allocation in sctp_init()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-22 18:40 +0200
Subject[PATCH 2/5] sctp: Delete an error message for a failed memory allocation in sctp_init()
Message-ID<tJYxc-83k-27@gated-at.bofh.it>
In reply to#1647131
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 22 May 2017 17:28:14 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 net/sctp/protocol.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 2b1a6215bd2f..5e7c8a344770 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1447,5 +1447,4 @@ static __init int sctp_init(void)
 	if (!sctp_ep_hashtable) {
-		pr_err("Failed endpoint_hash alloc\n");
 		status = -ENOMEM;
 		goto err_ehash_alloc;
 	}
-- 
2.13.0

[toc] | [prev] | [next] | [standalone]


#1647164 — Re: [PATCH 2/5] sctp: Delete an error message for a failed memory allocation in sctp_init()

FromMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date2017-05-22 19:00 +0200
SubjectRe: [PATCH 2/5] sctp: Delete an error message for a failed memory allocation in sctp_init()
Message-ID<tJYQy-8az-33@gated-at.bofh.it>
In reply to#1647139
On Mon, May 22, 2017 at 06:38:21PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 22 May 2017 17:28:14 +0200
> 
> Omit an extra message for a memory allocation failure in this function.
> 
> This issue was detected by using the Coccinelle software.
> 
> Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  net/sctp/protocol.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
> index 2b1a6215bd2f..5e7c8a344770 100644
> --- a/net/sctp/protocol.c
> +++ b/net/sctp/protocol.c
> @@ -1447,5 +1447,4 @@ static __init int sctp_init(void)
>  	if (!sctp_ep_hashtable) {
> -		pr_err("Failed endpoint_hash alloc\n");

Okay but then why not also delete the one a few lines below this one:
        if (!sctp_port_hashtable) {
                pr_err("Failed bind hash alloc\n");
                status = -ENOMEM;
                goto err_bhash_alloc;
        }
Seems the same pattern to me.

>  		status = -ENOMEM;
>  		goto err_ehash_alloc;
>  	}
> -- 
> 2.13.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [next] | [standalone]


#1647315 — Re: [PATCH 2/5] sctp: Delete an error message for a failed memory allocation in sctp_init()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-22 21:50 +0200
SubjectRe: [PATCH 2/5] sctp: Delete an error message for a failed memory allocation in sctp_init()
Message-ID<tK1v4-1nY-39@gated-at.bofh.it>
In reply to#1647164
>> +++ b/net/sctp/protocol.c
>> @@ -1447,5 +1447,4 @@ static __init int sctp_init(void)
>>  	if (!sctp_ep_hashtable) {
>> -		pr_err("Failed endpoint_hash alloc\n");
> 
> Okay but then why not also delete the one a few lines below this one:
>         if (!sctp_port_hashtable) {
>                 pr_err("Failed bind hash alloc\n");
>                 status = -ENOMEM;
>                 goto err_bhash_alloc;
>         }
> Seems the same pattern to me.
> 
>>  		status = -ENOMEM;
>>  		goto err_ehash_alloc;
>>  	}

How do you think about to remove the other error message in another
update step if a consensus would be achieved in such a direction
for this software module?

Regards,
Markus

[toc] | [prev] | [next] | [standalone]


#1647325 — Re: [PATCH 2/5] sctp: Delete an error message for a failed memory allocation in sctp_init()

FromMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date2017-05-22 22:00 +0200
SubjectRe: [PATCH 2/5] sctp: Delete an error message for a failed memory allocation in sctp_init()
Message-ID<tK1EL-1rk-23@gated-at.bofh.it>
In reply to#1647315
On Mon, May 22, 2017 at 09:46:21PM +0200, SF Markus Elfring wrote:
> >> +++ b/net/sctp/protocol.c
> >> @@ -1447,5 +1447,4 @@ static __init int sctp_init(void)
> >>  	if (!sctp_ep_hashtable) {
> >> -		pr_err("Failed endpoint_hash alloc\n");
> > 
> > Okay but then why not also delete the one a few lines below this one:
> >         if (!sctp_port_hashtable) {
> >                 pr_err("Failed bind hash alloc\n");
> >                 status = -ENOMEM;
> >                 goto err_bhash_alloc;
> >         }
> > Seems the same pattern to me.
> > 
> >>  		status = -ENOMEM;
> >>  		goto err_ehash_alloc;
> >>  	}
> 
> How do you think about to remove the other error message in another
> update step if a consensus would be achieved in such a direction
> for this software module?

Fine by me.

Regards,
  Marcelo

[toc] | [prev] | [next] | [standalone]


#1647322 — Re: [PATCH 2/5] sctp: Delete an error message for a failed memory allocation in sctp_init()

FromMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date2017-05-22 22:00 +0200
SubjectRe: [PATCH 2/5] sctp: Delete an error message for a failed memory allocation in sctp_init()
Message-ID<tK1EL-1rk-17@gated-at.bofh.it>
In reply to#1647139
On Mon, May 22, 2017 at 06:38:21PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 22 May 2017 17:28:14 +0200
> 
> Omit an extra message for a memory allocation failure in this function.
> 
> This issue was detected by using the Coccinelle software.
> 
> Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

> ---
>  net/sctp/protocol.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
> index 2b1a6215bd2f..5e7c8a344770 100644
> --- a/net/sctp/protocol.c
> +++ b/net/sctp/protocol.c
> @@ -1447,5 +1447,4 @@ static __init int sctp_init(void)
>  	if (!sctp_ep_hashtable) {
> -		pr_err("Failed endpoint_hash alloc\n");
>  		status = -ENOMEM;
>  		goto err_ehash_alloc;
>  	}
> -- 
> 2.13.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [next] | [standalone]


#1647387 — Re: [PATCH 2/5] sctp: Delete an error message for a failed memory allocation in sctp_init()

FromVlad Yasevich <vyasevic@redhat.com>
Date2017-05-22 23:00 +0200
SubjectRe: [PATCH 2/5] sctp: Delete an error message for a failed memory allocation in sctp_init()
Message-ID<tK2AP-1ZI-29@gated-at.bofh.it>
In reply to#1647139
On 05/22/2017 12:38 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 22 May 2017 17:28:14 +0200
> 
> Omit an extra message for a memory allocation failure in this function.
> 
> This issue was detected by using the Coccinelle software.
> 
> Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  net/sctp/protocol.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
> index 2b1a6215bd2f..5e7c8a344770 100644
> --- a/net/sctp/protocol.c
> +++ b/net/sctp/protocol.c
> @@ -1447,5 +1447,4 @@ static __init int sctp_init(void)
>  	if (!sctp_ep_hashtable) {
> -		pr_err("Failed endpoint_hash alloc\n");
>  		status = -ENOMEM;
>  		goto err_ehash_alloc;
>  	}
> 

Acked-by: Vlad Yasevich <vyasevich@gmail.com>

At the time this was written, it was patterned after TCP.  Since then TCP changed
significantly.  We can surely clean-up the pr_err() here and possibly update the
code as well later.

-vlad

[toc] | [prev] | [next] | [standalone]


#1647144 — [PATCH 5/5] sctp: Adjust one function call together with a variable assignment

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-22 18:50 +0200
Subject[PATCH 5/5] sctp: Adjust one function call together with a variable assignment
Message-ID<tJYGR-86U-11@gated-at.bofh.it>
In reply to#1647131
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 22 May 2017 18:15:12 +0200

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 net/sctp/protocol.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 057479b7bd72..be2fe3ebae78 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -141,7 +141,8 @@ static void sctp_v4_copy_addrlist(struct list_head *addrlist,
 	struct sctp_sockaddr_entry *addr;
 
 	rcu_read_lock();
-	if ((in_dev = __in_dev_get_rcu(dev)) == NULL) {
+	in_dev = __in_dev_get_rcu(dev);
+	if (!in_dev) {
 		rcu_read_unlock();
 		return;
 	}
-- 
2.13.0

[toc] | [prev] | [next] | [standalone]


#1647319 — Re: [PATCH 5/5] sctp: Adjust one function call together with a variable assignment

FromMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date2017-05-22 22:00 +0200
SubjectRe: [PATCH 5/5] sctp: Adjust one function call together with a variable assignment
Message-ID<tK1EK-1rk-9@gated-at.bofh.it>
In reply to#1647144
On Mon, May 22, 2017 at 06:41:45PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 22 May 2017 18:15:12 +0200
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> ERROR: do not use assignment in if condition
> 
> Thus fix the affected source code place.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

> ---
>  net/sctp/protocol.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
> index 057479b7bd72..be2fe3ebae78 100644
> --- a/net/sctp/protocol.c
> +++ b/net/sctp/protocol.c
> @@ -141,7 +141,8 @@ static void sctp_v4_copy_addrlist(struct list_head *addrlist,
>  	struct sctp_sockaddr_entry *addr;
>  
>  	rcu_read_lock();
> -	if ((in_dev = __in_dev_get_rcu(dev)) == NULL) {
> +	in_dev = __in_dev_get_rcu(dev);
> +	if (!in_dev) {
>  		rcu_read_unlock();
>  		return;
>  	}
> -- 
> 2.13.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [next] | [standalone]


#1647391 — Re: [PATCH 5/5] sctp: Adjust one function call together with a variable assignment

FromVlad Yasevich <vyasevic@redhat.com>
Date2017-05-22 23:10 +0200
SubjectRe: [PATCH 5/5] sctp: Adjust one function call together with a variable assignment
Message-ID<tK2Kt-2hW-17@gated-at.bofh.it>
In reply to#1647144
On 05/22/2017 12:41 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 22 May 2017 18:15:12 +0200
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> ERROR: do not use assignment in if condition
> 
> Thus fix the affected source code place.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  net/sctp/protocol.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
> index 057479b7bd72..be2fe3ebae78 100644
> --- a/net/sctp/protocol.c
> +++ b/net/sctp/protocol.c
> @@ -141,7 +141,8 @@ static void sctp_v4_copy_addrlist(struct list_head *addrlist,
>  	struct sctp_sockaddr_entry *addr;
>  
>  	rcu_read_lock();
> -	if ((in_dev = __in_dev_get_rcu(dev)) == NULL) {
> +	in_dev = __in_dev_get_rcu(dev);
> +	if (!in_dev) {
>  		rcu_read_unlock();
>  		return;
>  	}
> 

Acked-by: Vlad Yasevich <vyasevich@gmail.com>

-vlad

[toc] | [prev] | [next] | [standalone]


#1647149 — [PATCH 3/5] sctp: Fix a typo in a comment line in sctp_init()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-22 18:50 +0200
Subject[PATCH 3/5] sctp: Fix a typo in a comment line in sctp_init()
Message-ID<tJYGS-86U-23@gated-at.bofh.it>
In reply to#1647131
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 22 May 2017 17:43:44 +0200

Add a missing character in this description.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 net/sctp/protocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 5e7c8a344770..64756c42cec9 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1454,7 +1454,7 @@ static __init int sctp_init(void)
 	}
 
 	/* Allocate and initialize the SCTP port hash table.
-	 * Note that order is initalized to start at the max sized
+	 * Note that order is initialized to start at the max sized
 	 * table we want to support.  If we can't get that many pages
 	 * reduce the order and try again
 	 */
-- 
2.13.0

[toc] | [prev] | [next] | [standalone]


#1647317 — Re: [PATCH 3/5] sctp: Fix a typo in a comment line in sctp_init()

FromMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date2017-05-22 22:00 +0200
SubjectRe: [PATCH 3/5] sctp: Fix a typo in a comment line in sctp_init()
Message-ID<tK1EK-1rk-3@gated-at.bofh.it>
In reply to#1647149
On Mon, May 22, 2017 at 06:39:29PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 22 May 2017 17:43:44 +0200
> 
> Add a missing character in this description.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

> ---
>  net/sctp/protocol.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
> index 5e7c8a344770..64756c42cec9 100644
> --- a/net/sctp/protocol.c
> +++ b/net/sctp/protocol.c
> @@ -1454,7 +1454,7 @@ static __init int sctp_init(void)
>  	}
>  
>  	/* Allocate and initialize the SCTP port hash table.
> -	 * Note that order is initalized to start at the max sized
> +	 * Note that order is initialized to start at the max sized
>  	 * table we want to support.  If we can't get that many pages
>  	 * reduce the order and try again
>  	 */
> -- 
> 2.13.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [next] | [standalone]


#1647389 — Re: [PATCH 3/5] sctp: Fix a typo in a comment line in sctp_init()

FromVlad Yasevich <vyasevic@redhat.com>
Date2017-05-22 23:10 +0200
SubjectRe: [PATCH 3/5] sctp: Fix a typo in a comment line in sctp_init()
Message-ID<tK2Kt-2hW-9@gated-at.bofh.it>
In reply to#1647149
On 05/22/2017 12:39 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 22 May 2017 17:43:44 +0200
> 
> Add a missing character in this description.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  net/sctp/protocol.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
> index 5e7c8a344770..64756c42cec9 100644
> --- a/net/sctp/protocol.c
> +++ b/net/sctp/protocol.c
> @@ -1454,7 +1454,7 @@ static __init int sctp_init(void)
>  	}
>  
>  	/* Allocate and initialize the SCTP port hash table.
> -	 * Note that order is initalized to start at the max sized
> +	 * Note that order is initialized to start at the max sized
>  	 * table we want to support.  If we can't get that many pages
>  	 * reduce the order and try again
>  	 */
> 

Acked-by: Vlad Yasevich <vyasevich@gmail.com.

-vlad

[toc] | [prev] | [next] | [standalone]


#1647151 — [PATCH 4/5] sctp: Improve a size determination in sctp_inetaddr_event()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-22 18:50 +0200
Subject[PATCH 4/5] sctp: Improve a size determination in sctp_inetaddr_event()
Message-ID<tJYGS-86U-25@gated-at.bofh.it>
In reply to#1647131
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 22 May 2017 18:08:24 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 net/sctp/protocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 64756c42cec9..057479b7bd72 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -784,7 +784,7 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
 
 	switch (ev) {
 	case NETDEV_UP:
-		addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC);
+		addr = kmalloc(sizeof(*addr), GFP_ATOMIC);
 		if (addr) {
 			addr->a.v4.sin_family = AF_INET;
 			addr->a.v4.sin_port = 0;
-- 
2.13.0

[toc] | [prev] | [next] | [standalone]


#1647324 — Re: [PATCH 4/5] sctp: Improve a size determination in sctp_inetaddr_event()

FromMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date2017-05-22 22:00 +0200
SubjectRe: [PATCH 4/5] sctp: Improve a size determination in sctp_inetaddr_event()
Message-ID<tK1EL-1rk-21@gated-at.bofh.it>
In reply to#1647151
On Mon, May 22, 2017 at 06:40:37PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 22 May 2017 18:08:24 +0200
> 
> Replace the specification of a data structure by a pointer dereference
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

> ---
>  net/sctp/protocol.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
> index 64756c42cec9..057479b7bd72 100644
> --- a/net/sctp/protocol.c
> +++ b/net/sctp/protocol.c
> @@ -784,7 +784,7 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
>  
>  	switch (ev) {
>  	case NETDEV_UP:
> -		addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC);
> +		addr = kmalloc(sizeof(*addr), GFP_ATOMIC);
>  		if (addr) {
>  			addr->a.v4.sin_family = AF_INET;
>  			addr->a.v4.sin_port = 0;
> -- 
> 2.13.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [next] | [standalone]


#1647392 — Re: [PATCH 4/5] sctp: Improve a size determination in sctp_inetaddr_event()

FromVlad Yasevich <vyasevic@redhat.com>
Date2017-05-22 23:10 +0200
SubjectRe: [PATCH 4/5] sctp: Improve a size determination in sctp_inetaddr_event()
Message-ID<tK2Kt-2hW-19@gated-at.bofh.it>
In reply to#1647151
On 05/22/2017 12:40 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 22 May 2017 18:08:24 +0200
> 
> Replace the specification of a data structure by a pointer dereference
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  net/sctp/protocol.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
> index 64756c42cec9..057479b7bd72 100644
> --- a/net/sctp/protocol.c
> +++ b/net/sctp/protocol.c
> @@ -784,7 +784,7 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
>  
>  	switch (ev) {
>  	case NETDEV_UP:
> -		addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC);
> +		addr = kmalloc(sizeof(*addr), GFP_ATOMIC);
>  		if (addr) {
>  			addr->a.v4.sin_family = AF_INET;
>  			addr->a.v4.sin_port = 0;
> 

Acked-by: Vlad Yasevich <vyasevich@gmail.com>

-vlad

[toc] | [prev] | [next] | [standalone]


#1647674

FromXin Long <lucien.xin@gmail.com>
Date2017-05-23 08:40 +0200
Message-ID<tKbE5-7Qs-7@gated-at.bofh.it>
In reply to#1647131
On Tue, May 23, 2017 at 12:35 AM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 22 May 2017 18:30:45 +0200
>
> A few update suggestions were taken into account
> from static source code analysis.
>
> Markus Elfring (5):
>   Use kmalloc_array() in sctp_init()
>   Delete an error message for a failed memory allocation in sctp_init()
>   Fix a typo in a comment line in sctp_init()
>   Improve a size determination in sctp_inetaddr_event()
>   Adjust one function call together with a variable assignment
>
>  net/sctp/protocol.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
I guess these patches are for net-next.git

Series Reviewed-by: Xin Long <lucien.xin@gmail.com>

>
> --
> 2.13.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web