[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6f64703a-19f7-ca61-af7c-af1ac72cccc0@intel.com>
Date: Thu, 19 Jan 2023 18:04:58 -0800
From: Jesse Brandeburg <jesse.brandeburg@...el.com>
To: Yang Yingliang <yangyingliang@...wei.com>, <netdev@...r.kernel.org>
CC: <lars.povlsen@...rochip.com>, <Steen.Hegelund@...rochip.com>,
<daniel.machon@...rochip.com>, <UNGLinuxDriver@...rochip.com>,
<davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>
Subject: Re: [PATCH net-next] net: microchip: vcap: use kmemdup() to allocate
memory
On 1/19/2023 1:22 AM, Yang Yingliang wrote:
> Use kmemdup() helper instead of open-coding to simplify
> the code when allocating newckf and newcaf.
>
> Generated by: scripts/coccinelle/api/memdup.cocci
>
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> ---
> drivers/net/ethernet/microchip/vcap/vcap_api.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
I don't like kmemdup much as you have to be very careful to make sure
the original memory is freed in the error case. However this code seems
like it works correctly since it was already having to free the source
memory earlier.
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@...el.com>
Powered by blists - more mailing lists