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 11:22:06 +0200	[thread overview]
Message-ID: <20250225092206.GG53094@unreal> (raw)
In-Reply-To: <20250225082832.GA6982@breakpoint.cc>

On Tue, Feb 25, 2025 at 09:28:32AM +0100, Florian Westphal wrote:
> Leon Romanovsky <leon@kernel.org> wrote:
> > > 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.
> 
> Compiler will warn when the argument is something other than a pointer
> to a hlist_head.

I personally didn't see any bug where wrong pointer was passed to kfree :).

> 
> I can send a v2 with this wrapper removed if you don't think its worth it.

It is up to you.

> 
> Thanks for reviewing.
> 

  reply	other threads:[~2025-02-25  9:22 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
2025-02-25  8:28   ` Florian Westphal
2025-02-25  9:22     ` Leon Romanovsky [this message]
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=20250225092206.GG53094@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.