[PATCH] RxRPC: Fix kcalloc parameters swapped

Subsystems: networking [general], rxrpc sockets (af_rxrpc), the rest

STALE5295d

3 messages, 3 authors, 2012-02-14 · open the first message on its own page

[PATCH] RxRPC: Fix kcalloc parameters swapped

From: Axel Lin <hidden>
Date: 2012-02-14 06:19:24

The first parameter should be "number of elements" and the second parameter
should be "element size".

Signed-off-by: Axel Lin <redacted>
---
 net/rxrpc/ar-key.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/rxrpc/ar-key.c b/net/rxrpc/ar-key.c
index 4cba13e..ae3a035 100644
--- a/net/rxrpc/ar-key.c
+++ b/net/rxrpc/ar-key.c
@@ -232,7 +232,7 @@ static int rxrpc_krb5_decode_principal(struct krb5_principal *princ,
 	if (toklen <= (n_parts + 1) * 4)
 		return -EINVAL;
 
-	princ->name_parts = kcalloc(sizeof(char *), n_parts, GFP_KERNEL);
+	princ->name_parts = kcalloc(n_parts, sizeof(char *), GFP_KERNEL);
 	if (!princ->name_parts)
 		return -ENOMEM;
 
@@ -355,7 +355,7 @@ static int rxrpc_krb5_decode_tagged_array(struct krb5_tagged_data **_td,
 
 		_debug("n_elem %d", n_elem);
 
-		td = kcalloc(sizeof(struct krb5_tagged_data), n_elem,
+		td = kcalloc(n_elem, sizeof(struct krb5_tagged_data),
 			     GFP_KERNEL);
 		if (!td)
 			return -ENOMEM;
-- 
1.7.5.4

Re: [PATCH] RxRPC: Fix kcalloc parameters swapped

From: David Howells <dhowells@redhat.com>
Date: 2012-02-14 16:04:00

Axel Lin [off-list ref] wrote:
The first parameter should be "number of elements" and the second parameter
should be "element size".

Signed-off-by: Axel Lin <redacted>
Not that it matters, I think, but let's be consistent...

Acked-by: David Howells <dhowells@redhat.com>

Re: [PATCH] RxRPC: Fix kcalloc parameters swapped

From: David Miller <davem@davemloft.net>
Date: 2012-02-14 19:43:23

From: David Howells <dhowells@redhat.com>
Date: Tue, 14 Feb 2012 16:03:28 +0000
Axel Lin [off-list ref] wrote:
quoted
The first parameter should be "number of elements" and the second parameter
should be "element size".

Signed-off-by: Axel Lin <redacted>
Not that it matters, I think, but let's be consistent...

Acked-by: David Howells <dhowells@redhat.com>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help