* [PATCH 0/2] tipc: Fine-tuning for three function implementations
@ 2017-11-08 21:33 SF Markus Elfring
2017-11-08 21:34 ` [PATCH 1/2] tipc: Use common error handling code in tipc_server_start() SF Markus Elfring
2017-11-08 21:35 ` [PATCH 2/2] tipc: Improve a size determination in two functions SF Markus Elfring
0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-11-08 21:33 UTC (permalink / raw)
To: tipc-discussion, netdev, David S. Miller, Jon Maloy, Ying Xue
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 8 Nov 2017 22:30:03 +0100
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Use common error handling code in tipc_server_start()
Improve a size determination in two functions
net/tipc/server.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
--
2.15.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] tipc: Use common error handling code in tipc_server_start()
2017-11-08 21:33 [PATCH 0/2] tipc: Fine-tuning for three function implementations SF Markus Elfring
@ 2017-11-08 21:34 ` SF Markus Elfring
2017-11-08 21:35 ` [PATCH 2/2] tipc: Improve a size determination in two functions SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-11-08 21:34 UTC (permalink / raw)
To: tipc-discussion, netdev, David S. Miller, Jon Maloy, Ying Xue
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 8 Nov 2017 22:18:35 +0100
* Improve jump targets so that a bit of exception handling can be better
reused at the end of this function.
* Adjust two condition checks.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
net/tipc/server.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/net/tipc/server.c b/net/tipc/server.c
index acaef80fb88c..7359d37e39cd 100644
--- a/net/tipc/server.c
+++ b/net/tipc/server.c
@@ -670,16 +670,19 @@ int tipc_server_start(struct tipc_server *s)
return -ENOMEM;
ret = tipc_work_start(s);
- if (ret < 0) {
- kmem_cache_destroy(s->rcvbuf_cache);
- return ret;
- }
+ if (ret)
+ goto destroy_cache;
+
ret = tipc_open_listening_sock(s);
- if (ret < 0) {
- tipc_work_stop(s);
- kmem_cache_destroy(s->rcvbuf_cache);
- return ret;
- }
+ if (ret)
+ goto stop_work;
+
+ return 0;
+
+stop_work:
+ tipc_work_stop(s);
+destroy_cache:
+ kmem_cache_destroy(s->rcvbuf_cache);
return ret;
}
--
2.15.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] tipc: Improve a size determination in two functions
2017-11-08 21:33 [PATCH 0/2] tipc: Fine-tuning for three function implementations SF Markus Elfring
2017-11-08 21:34 ` [PATCH 1/2] tipc: Use common error handling code in tipc_server_start() SF Markus Elfring
@ 2017-11-08 21:35 ` SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-11-08 21:35 UTC (permalink / raw)
To: tipc-discussion, netdev, David S. Miller, Jon Maloy, Ying Xue
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 8 Nov 2017 22:23:07 +0100
Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
net/tipc/server.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/tipc/server.c b/net/tipc/server.c
index 7359d37e39cd..5d001b6acbe5 100644
--- a/net/tipc/server.c
+++ b/net/tipc/server.c
@@ -219,7 +219,7 @@ static struct tipc_conn *tipc_alloc_conn(struct tipc_server *s)
struct tipc_conn *con;
int ret;
- con = kzalloc(sizeof(struct tipc_conn), GFP_ATOMIC);
+ con = kzalloc(sizeof(*con), GFP_ATOMIC);
if (!con)
return ERR_PTR(-ENOMEM);
@@ -410,7 +410,7 @@ static struct outqueue_entry *tipc_alloc_entry(void *data, int len)
struct outqueue_entry *entry;
void *buf;
- entry = kmalloc(sizeof(struct outqueue_entry), GFP_ATOMIC);
+ entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
if (!entry)
return NULL;
--
2.15.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-08 21:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-08 21:33 [PATCH 0/2] tipc: Fine-tuning for three function implementations SF Markus Elfring
2017-11-08 21:34 ` [PATCH 1/2] tipc: Use common error handling code in tipc_server_start() SF Markus Elfring
2017-11-08 21:35 ` [PATCH 2/2] tipc: Improve a size determination in two functions SF Markus Elfring
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).