[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230908112933.kvw5txzrw6l4rb2n@DEN-LT-70577>
Date: Fri, 8 Sep 2023 11:29:33 +0000
From: Daniel Machon <daniel.machon@...rochip.com>
To: Jinjie Ruan <ruanjinjie@...wei.com>
CC: <lars.povlsen@...rochip.com>, <Steen.Hegelund@...rochip.com>,
<davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>, <linux-arm-kernel@...ts.infradead.org>,
<netdev@...r.kernel.org>, <UNGLinuxDriver@...rochip.com>
Subject: Re: [PATCH net 2/5] net: microchip: sparx5: Fix memory leak for
vcap_api_rule_add_actionvalue_test()
> Inject fault while probing kunit-example-test.ko, the field which
> is allocated by kzalloc in vcap_rule_add_action() of
> vcap_rule_add_action_bit/u32() is not freed, and it cause
> the memory leaks below.
>
> Fixes: c956b9b318d9 ("net: microchip: sparx5: Adding KUNIT tests of key/action values in VCAP API")
> Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
> ---
> .../net/ethernet/microchip/vcap/vcap_api_kunit.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c b/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c
> index 2fb0b8cf2b0c..aa79bcf3efc2 100644
> --- a/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c
> +++ b/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c
> @@ -1095,6 +1095,16 @@ static void vcap_api_rule_add_keyvalue_test(struct kunit *test)
> vcap_free_ckf(rule);
> }
>
> +static void vcap_free_caf(struct vcap_rule *rule)
> +{
> + struct vcap_client_actionfield *caf, *next_caf;
> +
> + list_for_each_entry_safe(caf, next_caf, &rule->actionfields, ctrl.list) {
> + list_del(&caf->ctrl.list);
> + kfree(caf);
> + }
> +}
> +
Hi Jinjie,
It seems like you need to respin anyway, so could you please fix this
patch to adhere to the 80 character limit. Checkpatch generates a
warning.
/Daniel
Powered by blists - more mailing lists