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


Groups > linux.kernel > #1646960 > unrolled thread

[PATCH 0/3] RDS: Adjustments for two function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-05-22 16:20 +0200
Last post2017-05-22 21:30 +0200
Articles 7 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] RDS: Adjustments for two function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-22 16:20 +0200
    [PATCH 3/3] RDS: TCP: Delete an error message for a failed memory  allocation in rds_tcp_init_net() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-22 16:20 +0200
      Re: [PATCH 3/3] RDS: TCP: Delete an error message for a failed  memory allocation in rds_tcp_init_net() Sowmini Varadhan <sowmini.varadhan@oracle.com> - 2017-05-22 16:30 +0200
        Re: RDS: TCP: Delete an error message for a failed memory allocation  in rds_tcp_init_net() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-22 16:40 +0200
          Re: RDS: TCP: Delete an error message for a failed memory allocation  in rds_tcp_init_net() Sowmini Varadhan <sowmini.varadhan@oracle.com> - 2017-05-22 16:50 +0200
    [PATCH 2/3] RDS: IB: Improve a size determination in rds_ib_add_one() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-22 16:20 +0200
      Re: [PATCH 2/3] RDS: IB: Improve a size determination in  rds_ib_add_one() Santosh Shilimkar <santosh.shilimkar@oracle.com> - 2017-05-22 21:30 +0200

#1646960 — [PATCH 0/3] RDS: Adjustments for two function implementations

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-22 16:20 +0200
Subject[PATCH 0/3] RDS: Adjustments for two function implementations
Message-ID<tJWlI-6KH-9@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 22 May 2017 16:02:03 +0200

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

Markus Elfring (3):
  Delete an error message for a failed memory allocation in rds_ib_add_one()
  Improve a size determination in rds_ib_add_one()
  Delete an error message for a failed memory allocation in rds_tcp_init_net()

 net/rds/ib.c  | 7 ++-----
 net/rds/tcp.c | 5 ++---
 2 files changed, 4 insertions(+), 8 deletions(-)

-- 
2.13.0

[toc] | [next] | [standalone]


#1646966 — [PATCH 3/3] RDS: TCP: Delete an error message for a failed memory allocation in rds_tcp_init_net()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-22 16:20 +0200
Subject[PATCH 3/3] RDS: TCP: Delete an error message for a failed memory allocation in rds_tcp_init_net()
Message-ID<tJWlJ-6KH-29@gated-at.bofh.it>
In reply to#1646960
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 22 May 2017 15:45:31 +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/rds/tcp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/rds/tcp.c b/net/rds/tcp.c
index 431404dbdad1..b0348697dee5 100644
--- a/net/rds/tcp.c
+++ b/net/rds/tcp.c
@@ -431,10 +431,9 @@ static __net_init int rds_tcp_init_net(struct net *net)
 	} else {
 		tbl = kmemdup(rds_tcp_sysctl_table,
 			      sizeof(rds_tcp_sysctl_table), GFP_KERNEL);
-		if (!tbl) {
-			pr_warn("could not set allocate syctl table\n");
+		if (!tbl)
 			return -ENOMEM;
-		}
+
 		rtn->ctl_table = tbl;
 	}
 	tbl[RDS_TCP_SNDBUF].data = &rtn->sndbuf_size;
-- 
2.13.0

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


#1646978 — Re: [PATCH 3/3] RDS: TCP: Delete an error message for a failed memory allocation in rds_tcp_init_net()

FromSowmini Varadhan <sowmini.varadhan@oracle.com>
Date2017-05-22 16:30 +0200
SubjectRe: [PATCH 3/3] RDS: TCP: Delete an error message for a failed memory allocation in rds_tcp_init_net()
Message-ID<tJWvo-6NX-11@gated-at.bofh.it>
In reply to#1646966
On (05/22/17 16:13), SF Markus Elfring wrote:
> 
> Omit an extra message for a memory allocation failure in this function.

The change itself is harmless,  but I'm curious about the "extra"
part: "extra" from what? If this happens, hopefully this will be logged
somewhere? Note that this type of (infrequent) logging noise is useful
in some cases, e.g., with 8ce675ff, when one is trying to do the
post-mortem of where things first went wrong.

--Sowmini

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


#1646989 — Re: RDS: TCP: Delete an error message for a failed memory allocation in rds_tcp_init_net()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-22 16:40 +0200
SubjectRe: RDS: TCP: Delete an error message for a failed memory allocation in rds_tcp_init_net()
Message-ID<tJWF4-6Ra-23@gated-at.bofh.it>
In reply to#1646978
>> Omit an extra message for a memory allocation failure in this function.
> 
> The change itself is harmless,  but I'm curious about the "extra"
> part: "extra" from what? If this happens, hopefully this will be logged
> somewhere? Note that this type of (infrequent) logging noise is useful
> in some cases, e.g., with 8ce675ff, when one is trying to do the
> post-mortem of where things first went wrong.

Do you find information from a Linux allocation failure report sufficient
for such an use case?

Regards,
Markus

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


#1647002 — Re: RDS: TCP: Delete an error message for a failed memory allocation in rds_tcp_init_net()

FromSowmini Varadhan <sowmini.varadhan@oracle.com>
Date2017-05-22 16:50 +0200
SubjectRe: RDS: TCP: Delete an error message for a failed memory allocation in rds_tcp_init_net()
Message-ID<tJWOK-6Ut-5@gated-at.bofh.it>
In reply to#1646989
> Do you find information from a Linux allocation failure report sufficient
> for such an use case?

yes, I suppose that would cover the needed cases. 
Your change looks good to me.

Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>

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


#1646967 — [PATCH 2/3] RDS: IB: Improve a size determination in rds_ib_add_one()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-22 16:20 +0200
Subject[PATCH 2/3] RDS: IB: Improve a size determination in rds_ib_add_one()
Message-ID<tJWlJ-6KH-31@gated-at.bofh.it>
In reply to#1646960
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 22 May 2017 15:40:21 +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/rds/ib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/rds/ib.c b/net/rds/ib.c
index c5514d058171..ed37bf011704 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -131,7 +131,7 @@ static void rds_ib_add_one(struct ib_device *device)
 	if (device->node_type != RDMA_NODE_IB_CA)
 		return;
 
-	rds_ibdev = kzalloc_node(sizeof(struct rds_ib_device), GFP_KERNEL,
+	rds_ibdev = kzalloc_node(sizeof(*rds_ibdev), GFP_KERNEL,
 				 ibdev_to_node(device));
 	if (!rds_ibdev)
 		return;
-- 
2.13.0

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


#1647292 — Re: [PATCH 2/3] RDS: IB: Improve a size determination in rds_ib_add_one()

FromSantosh Shilimkar <santosh.shilimkar@oracle.com>
Date2017-05-22 21:30 +0200
SubjectRe: [PATCH 2/3] RDS: IB: Improve a size determination in rds_ib_add_one()
Message-ID<tK1bI-1hH-19@gated-at.bofh.it>
In reply to#1646967
On 5/22/2017 7:12 AM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 22 May 2017 15:40:21 +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: Santosh Shilimkar <santosh.shilimkar@oracle.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web