* [PATCH][next] rocker: fix kcalloc parameter order
@ 2017-09-03 20:26 Zahari Doychev
2017-09-04 5:40 ` Zahari Doychev
0 siblings, 1 reply; 2+ messages in thread
From: Zahari Doychev @ 2017-09-03 20:26 UTC (permalink / raw)
To: jiri, netdev; +Cc: Zahari Doychev
The function calls to kcalloc use wrong parameter order. The flags
have to be passed as last parameter.
The change was done using the following coccinelle script:
@@
expression E1,E2;
type T;
@@
-kcalloc(E1, E2, sizeof(T))
+kcalloc(E2, sizeof(T), E1)
Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
---
drivers/net/ethernet/rocker/rocker_ofdpa.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/rocker/rocker_ofdpa.c b/drivers/net/ethernet/rocker/rocker_ofdpa.c
index da4e26b53a52..2708451ce22a 100644
--- a/drivers/net/ethernet/rocker/rocker_ofdpa.c
+++ b/drivers/net/ethernet/rocker/rocker_ofdpa.c
@@ -1177,7 +1177,7 @@ static int ofdpa_group_l2_fan_out(struct ofdpa_port *ofdpa_port,
entry->group_id = group_id;
entry->group_count = group_count;
- entry->group_ids = kcalloc(flags, group_count, sizeof(u32));
+ entry->group_ids = kcalloc(group_count, sizeof(u32), flags);
if (!entry->group_ids) {
kfree(entry);
return -ENOMEM;
@@ -1456,7 +1456,7 @@ static int ofdpa_port_vlan_flood_group(struct ofdpa_port *ofdpa_port,
int err = 0;
int i;
- group_ids = kcalloc(flags, port_count, sizeof(u32));
+ group_ids = kcalloc(port_count, sizeof(u32), flags);
if (!group_ids)
return -ENOMEM;
--
2.13.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] rocker: fix kcalloc parameter order
2017-09-03 20:26 [PATCH][next] rocker: fix kcalloc parameter order Zahari Doychev
@ 2017-09-04 5:40 ` Zahari Doychev
0 siblings, 0 replies; 2+ messages in thread
From: Zahari Doychev @ 2017-09-04 5:40 UTC (permalink / raw)
To: Zahari Doychev; +Cc: jiri, netdev
On Sun, Sep 03, 2017 at 10:26:03PM +0200, Zahari Doychev wrote:
> The function calls to kcalloc use wrong parameter order. The flags
> have to be passed as last parameter.
>
> The change was done using the following coccinelle script:
>
> @@
> expression E1,E2;
> type T;
> @@
>
> -kcalloc(E1, E2, sizeof(T))
> +kcalloc(E2, sizeof(T), E1)
>
> Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
> ---
> drivers/net/ethernet/rocker/rocker_ofdpa.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/rocker/rocker_ofdpa.c b/drivers/net/ethernet/rocker/rocker_ofdpa.c
> index da4e26b53a52..2708451ce22a 100644
> --- a/drivers/net/ethernet/rocker/rocker_ofdpa.c
> +++ b/drivers/net/ethernet/rocker/rocker_ofdpa.c
> @@ -1177,7 +1177,7 @@ static int ofdpa_group_l2_fan_out(struct ofdpa_port *ofdpa_port,
> entry->group_id = group_id;
> entry->group_count = group_count;
>
> - entry->group_ids = kcalloc(flags, group_count, sizeof(u32));
> + entry->group_ids = kcalloc(group_count, sizeof(u32), flags);
I think that the flags are also not used correctly, so I will have to resend
the patch.
> if (!entry->group_ids) {
> kfree(entry);
> return -ENOMEM;
> @@ -1456,7 +1456,7 @@ static int ofdpa_port_vlan_flood_group(struct ofdpa_port *ofdpa_port,
> int err = 0;
> int i;
>
> - group_ids = kcalloc(flags, port_count, sizeof(u32));
> + group_ids = kcalloc(port_count, sizeof(u32), flags);
> if (!group_ids)
> return -ENOMEM;
>
> --
> 2.13.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-04 5:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-03 20:26 [PATCH][next] rocker: fix kcalloc parameter order Zahari Doychev
2017-09-04 5:40 ` Zahari Doychev
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).