* [PATCH 0/3] RDMA/iwpm: Adjustments for three function implementations
@ 2018-01-27 21:17 ` SF Markus Elfring
0 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-01-27 21:17 UTC (permalink / raw)
To: linux-rdma, Chien Tin Tung, Doug Ledford, Geert Uytterhoeven,
Jason Gunthorpe, Johannes Berg, Leon Romanovsky, Shiraz Saleem,
Tatyana Nikolova
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 22:12:34 +0100
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 iwpm_create_nlmsg()
Adjust a variable initialisation in iwpm_create_nlmsg()
Improve a size determination in two functions
drivers/infiniband/core/iwpm_util.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
--
2.16.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 0/3] RDMA/iwpm: Adjustments for three function implementations
@ 2018-01-27 21:17 ` SF Markus Elfring
0 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-01-27 21:17 UTC (permalink / raw)
To: linux-rdma, Chien Tin Tung, Doug Ledford, Geert Uytterhoeven,
Jason Gunthorpe, Johannes Berg, Leon Romanovsky, Shiraz Saleem,
Tatyana Nikolova
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 22:12:34 +0100
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 iwpm_create_nlmsg()
Adjust a variable initialisation in iwpm_create_nlmsg()
Improve a size determination in two functions
drivers/infiniband/core/iwpm_util.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
--
2.16.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] RDMA/iwpm: Delete an error message for a failed memory allocation in iwpm_create_nlmsg()
2018-01-27 21:17 ` SF Markus Elfring
@ 2018-01-27 21:19 ` SF Markus Elfring
-1 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-01-27 21:19 UTC (permalink / raw)
To: linux-rdma, Chien Tin Tung, Doug Ledford, Geert Uytterhoeven,
Jason Gunthorpe, Johannes Berg, Leon Romanovsky, Shiraz Saleem,
Tatyana Nikolova
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 21:48:01 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/infiniband/core/iwpm_util.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index 81528f64061a..9821ae900f6d 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -439,10 +439,9 @@ struct sk_buff *iwpm_create_nlmsg(u32 nl_op, struct nlmsghdr **nlh,
struct sk_buff *skb = NULL;
skb = dev_alloc_skb(IWPM_MSG_SIZE);
- if (!skb) {
- pr_err("%s Unable to allocate skb\n", __func__);
+ if (!skb)
goto create_nlmsg_exit;
- }
+
if (!(ibnl_put_msg(skb, nlh, 0, 0, nl_client, nl_op,
NLM_F_REQUEST))) {
pr_warn("%s: Unable to put the nlmsg header\n", __func__);
--
2.16.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 1/3] RDMA/iwpm: Delete an error message for a failed memory allocation in iwpm_create_nlmsg()
@ 2018-01-27 21:19 ` SF Markus Elfring
0 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-01-27 21:19 UTC (permalink / raw)
To: linux-rdma, Chien Tin Tung, Doug Ledford, Geert Uytterhoeven,
Jason Gunthorpe, Johannes Berg, Leon Romanovsky, Shiraz Saleem,
Tatyana Nikolova
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 21:48:01 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/infiniband/core/iwpm_util.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index 81528f64061a..9821ae900f6d 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -439,10 +439,9 @@ struct sk_buff *iwpm_create_nlmsg(u32 nl_op, struct nlmsghdr **nlh,
struct sk_buff *skb = NULL;
skb = dev_alloc_skb(IWPM_MSG_SIZE);
- if (!skb) {
- pr_err("%s Unable to allocate skb\n", __func__);
+ if (!skb)
goto create_nlmsg_exit;
- }
+
if (!(ibnl_put_msg(skb, nlh, 0, 0, nl_client, nl_op,
NLM_F_REQUEST))) {
pr_warn("%s: Unable to put the nlmsg header\n", __func__);
--
2.16.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/3] RDMA/iwpm: Adjust a variable initialisation in iwpm_create_nlmsg()
2018-01-27 21:17 ` SF Markus Elfring
@ 2018-01-27 21:20 ` SF Markus Elfring
-1 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-01-27 21:20 UTC (permalink / raw)
To: linux-rdma, Chien Tin Tung, Doug Ledford, Geert Uytterhoeven,
Jason Gunthorpe, Johannes Berg, Leon Romanovsky, Shiraz Saleem,
Tatyana Nikolova
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 21:56:54 +0100
The local variable "skb" will be reassigned by a following statement.
Thus adjust the initialisation at the beginning.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/infiniband/core/iwpm_util.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index 9821ae900f6d..9eb527074c32 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -436,9 +436,8 @@ int iwpm_compare_sockaddr(struct sockaddr_storage *a_sockaddr,
struct sk_buff *iwpm_create_nlmsg(u32 nl_op, struct nlmsghdr **nlh,
int nl_client)
{
- struct sk_buff *skb = NULL;
+ struct sk_buff *skb = dev_alloc_skb(IWPM_MSG_SIZE);
- skb = dev_alloc_skb(IWPM_MSG_SIZE);
if (!skb)
goto create_nlmsg_exit;
--
2.16.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/3] RDMA/iwpm: Adjust a variable initialisation in iwpm_create_nlmsg()
@ 2018-01-27 21:20 ` SF Markus Elfring
0 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-01-27 21:20 UTC (permalink / raw)
To: linux-rdma, Chien Tin Tung, Doug Ledford, Geert Uytterhoeven,
Jason Gunthorpe, Johannes Berg, Leon Romanovsky, Shiraz Saleem,
Tatyana Nikolova
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 21:56:54 +0100
The local variable "skb" will be reassigned by a following statement.
Thus adjust the initialisation at the beginning.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/infiniband/core/iwpm_util.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index 9821ae900f6d..9eb527074c32 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -436,9 +436,8 @@ int iwpm_compare_sockaddr(struct sockaddr_storage *a_sockaddr,
struct sk_buff *iwpm_create_nlmsg(u32 nl_op, struct nlmsghdr **nlh,
int nl_client)
{
- struct sk_buff *skb = NULL;
+ struct sk_buff *skb = dev_alloc_skb(IWPM_MSG_SIZE);
- skb = dev_alloc_skb(IWPM_MSG_SIZE);
if (!skb)
goto create_nlmsg_exit;
--
2.16.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/3] RDMA/iwpm: Improve a size determination in two functions
2018-01-27 21:17 ` SF Markus Elfring
(?)
@ 2018-01-27 21:21 ` SF Markus Elfring
-1 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-01-27 21:21 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Chien Tin Tung, Doug Ledford,
Geert Uytterhoeven, Jason Gunthorpe, Johannes Berg,
Leon Romanovsky, Shiraz Saleem, Tatyana Nikolova
Cc: LKML, kernel-janitors-u79uwXL29TY76Z2rM5mHXA
From: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Date: Sat, 27 Jan 2018 22:05:54 +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-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
---
drivers/infiniband/core/iwpm_util.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index 9eb527074c32..902a2677df31 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -121,7 +121,8 @@ int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,
if (!iwpm_valid_client(nl_client))
return ret;
- map_info = kzalloc(sizeof(struct iwpm_mapping_info), GFP_KERNEL);
+
+ map_info = kzalloc(sizeof(*map_info), GFP_KERNEL);
if (!map_info)
return -ENOMEM;
@@ -298,7 +299,7 @@ struct iwpm_nlmsg_request *iwpm_get_nlmsg_request(__u32 nlmsg_seq,
struct iwpm_nlmsg_request *nlmsg_request = NULL;
unsigned long flags;
- nlmsg_request = kzalloc(sizeof(struct iwpm_nlmsg_request), gfp);
+ nlmsg_request = kzalloc(sizeof(*nlmsg_request), gfp);
if (!nlmsg_request)
return NULL;
--
2.16.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/3] RDMA/iwpm: Improve a size determination in two functions
@ 2018-01-27 21:21 ` SF Markus Elfring
0 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-01-27 21:21 UTC (permalink / raw)
To: linux-rdma, Chien Tin Tung, Doug Ledford, Geert Uytterhoeven,
Jason Gunthorpe, Johannes Berg, Leon Romanovsky, Shiraz Saleem,
Tatyana Nikolova
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 22:05:54 +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>
---
drivers/infiniband/core/iwpm_util.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index 9eb527074c32..902a2677df31 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -121,7 +121,8 @@ int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,
if (!iwpm_valid_client(nl_client))
return ret;
- map_info = kzalloc(sizeof(struct iwpm_mapping_info), GFP_KERNEL);
+
+ map_info = kzalloc(sizeof(*map_info), GFP_KERNEL);
if (!map_info)
return -ENOMEM;
@@ -298,7 +299,7 @@ struct iwpm_nlmsg_request *iwpm_get_nlmsg_request(__u32 nlmsg_seq,
struct iwpm_nlmsg_request *nlmsg_request = NULL;
unsigned long flags;
- nlmsg_request = kzalloc(sizeof(struct iwpm_nlmsg_request), gfp);
+ nlmsg_request = kzalloc(sizeof(*nlmsg_request), gfp);
if (!nlmsg_request)
return NULL;
--
2.16.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/3] RDMA/iwpm: Improve a size determination in two functions
@ 2018-01-27 21:21 ` SF Markus Elfring
0 siblings, 0 replies; 11+ messages in thread
From: SF Markus Elfring @ 2018-01-27 21:21 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Chien Tin Tung, Doug Ledford,
Geert Uytterhoeven, Jason Gunthorpe, Johannes Berg,
Leon Romanovsky, Shiraz Saleem, Tatyana Nikolova
Cc: LKML, kernel-janitors-u79uwXL29TY76Z2rM5mHXA
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 22:05:54 +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>
---
drivers/infiniband/core/iwpm_util.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index 9eb527074c32..902a2677df31 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -121,7 +121,8 @@ int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,
if (!iwpm_valid_client(nl_client))
return ret;
- map_info = kzalloc(sizeof(struct iwpm_mapping_info), GFP_KERNEL);
+
+ map_info = kzalloc(sizeof(*map_info), GFP_KERNEL);
if (!map_info)
return -ENOMEM;
@@ -298,7 +299,7 @@ struct iwpm_nlmsg_request *iwpm_get_nlmsg_request(__u32 nlmsg_seq,
struct iwpm_nlmsg_request *nlmsg_request = NULL;
unsigned long flags;
- nlmsg_request = kzalloc(sizeof(struct iwpm_nlmsg_request), gfp);
+ nlmsg_request = kzalloc(sizeof(*nlmsg_request), gfp);
if (!nlmsg_request)
return NULL;
--
2.16.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] RDMA/iwpm: Delete an error message for a failed memory allocation in iwpm_create_nlmsg()
2018-01-27 21:19 ` SF Markus Elfring
@ 2018-02-28 21:14 ` Jason Gunthorpe
-1 siblings, 0 replies; 11+ messages in thread
From: Jason Gunthorpe @ 2018-02-28 21:14 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-rdma, Chien Tin Tung, Doug Ledford, Geert Uytterhoeven,
Johannes Berg, Leon Romanovsky, Shiraz Saleem, Tatyana Nikolova,
LKML, kernel-janitors
On Sat, Jan 27, 2018 at 10:19:05PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 27 Jan 2018 21:48:01 +0100
>
> Omit an extra message for a memory allocation failure in this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> drivers/infiniband/core/iwpm_util.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
applied to for-next
Jason
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] RDMA/iwpm: Delete an error message for a failed memory allocation in iwpm_create_nlm
@ 2018-02-28 21:14 ` Jason Gunthorpe
0 siblings, 0 replies; 11+ messages in thread
From: Jason Gunthorpe @ 2018-02-28 21:14 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-rdma, Chien Tin Tung, Doug Ledford, Geert Uytterhoeven,
Johannes Berg, Leon Romanovsky, Shiraz Saleem, Tatyana Nikolova,
LKML, kernel-janitors
On Sat, Jan 27, 2018 at 10:19:05PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 27 Jan 2018 21:48:01 +0100
>
> Omit an extra message for a memory allocation failure in this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> drivers/infiniband/core/iwpm_util.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
applied to for-next
Jason
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-02-28 21:14 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-27 21:17 [PATCH 0/3] RDMA/iwpm: Adjustments for three function implementations SF Markus Elfring
2018-01-27 21:17 ` SF Markus Elfring
2018-01-27 21:19 ` [PATCH 1/3] RDMA/iwpm: Delete an error message for a failed memory allocation in iwpm_create_nlmsg() SF Markus Elfring
2018-01-27 21:19 ` SF Markus Elfring
2018-02-28 21:14 ` Jason Gunthorpe
2018-02-28 21:14 ` [PATCH 1/3] RDMA/iwpm: Delete an error message for a failed memory allocation in iwpm_create_nlm Jason Gunthorpe
2018-01-27 21:20 ` [PATCH 2/3] RDMA/iwpm: Adjust a variable initialisation in iwpm_create_nlmsg() SF Markus Elfring
2018-01-27 21:20 ` SF Markus Elfring
[not found] ` <b1df0889-b967-97ae-3a3d-0dde0d7258cd-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
2018-01-27 21:21 ` [PATCH 3/3] RDMA/iwpm: Improve a size determination in two functions SF Markus Elfring
2018-01-27 21:21 ` SF Markus Elfring
2018-01-27 21:21 ` SF Markus Elfring
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.