[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <964c1290-4959-4dc6-a203-16941e7de0a2@redhat.com>
Date: Tue, 7 Jan 2025 11:33:49 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Jakub Kicinski <kuba@...nel.org>, davem@...emloft.net
Cc: netdev@...r.kernel.org, edumazet@...gle.com, dw@...idwei.uk,
almasrymina@...gle.com, jdamato@...tly.com
Subject: Re: [PATCH net-next 4/8] netdevsim: allocate rqs individually
On 1/3/25 7:59 PM, Jakub Kicinski wrote:
> @@ -682,10 +682,21 @@ static int nsim_queue_init(struct netdevsim *ns)
> if (!ns->rq)
> return -ENOMEM;
>
> - for (i = 0; i < dev->num_rx_queues; i++)
> - skb_queue_head_init(&ns->rq[i].skb_queue);
> + for (i = 0; i < dev->num_rx_queues; i++) {
> + ns->rq[i] = kzalloc(sizeof(**ns->rq), GFP_KERNEL);
> + if (!ns->rq[i])
> + goto err_free_prev;
> +
> + skb_queue_head_init(&ns->rq[i]->skb_queue);
> + }
>
> return 0;
> +
> +err_free_prev:
> + while (i--)
> + kfree(ns->rq[i]);
> + kfree(ns->rq);
FWIW, ns->rq is allocated with kvcalloc() above. kfree() usage is fine
but makes coccinelle unhappy. Perhaps worthy switching to kvfree() for
consistency with the existing code?
Thanks!
Paolo
Powered by blists - more mailing lists