All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Florian Westphal <fw@strlen.de>
Cc: netdev@vger.kernel.org, steffen.klassert@secunet.com,
	herbert@gondor.apana.org.au
Subject: Re: [PATCH ipsec-next] xfrm: remove hash table alloc/free helpers
Date: Tue, 25 Feb 2025 10:04:40 +0200	[thread overview]
Message-ID: <20250225080440.GE53094@unreal> (raw)
In-Reply-To: <20250224171055.15951-1-fw@strlen.de>

On Mon, Feb 24, 2025 at 06:10:50PM +0100, Florian Westphal wrote:
> These functions predate kvmalloc, update xfrm to use that instead.
> This also allows to drop the 'size' argument passed to xfrm_hash_free().
> 
> xfrm_hash_free() is kept around because of 'struct hlist_head *' arg type
> instead of 'void *'.

<...>

> -struct hlist_head *xfrm_hash_alloc(unsigned int sz);
> -void xfrm_hash_free(struct hlist_head *n, unsigned int sz);
> +static inline struct hlist_head *xfrm_hash_alloc(unsigned int sz)
> +{
> +	return kvzalloc(sz, GFP_KERNEL);
> +}
>  
> +static inline void xfrm_hash_free(struct hlist_head *n)
> +{
> +	kvfree(n);
> +}

Sorry, what does this wrapper give us?
You are passing pointer as is and there is no any pointer type check
that this construction will give us.

I would say that there is no need to hide basic kernel primitives
like kvzalloc and kvfree, and better leave them as is without wrappers.

The change itself looks good,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

  reply	other threads:[~2025-02-25  8:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24 17:10 [PATCH ipsec-next] xfrm: remove hash table alloc/free helpers Florian Westphal
2025-02-25  8:04 ` Leon Romanovsky [this message]
2025-02-25  8:28   ` Florian Westphal
2025-02-25  9:22     ` Leon Romanovsky
2025-02-25 21:25 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250225080440.GE53094@unreal \
    --to=leon@kernel.org \
    --cc=fw@strlen.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.