[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250225092206.GG53094@unreal>
Date: Tue, 25 Feb 2025 11:22:06 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Florian Westphal <fw@...len.de>
Cc: netdev@...r.kernel.org, steffen.klassert@...unet.com,
herbert@...dor.apana.org.au
Subject: Re: [PATCH ipsec-next] xfrm: remove hash table alloc/free helpers
On Tue, Feb 25, 2025 at 09:28:32AM +0100, Florian Westphal wrote:
> Leon Romanovsky <leon@...nel.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.
>
Powered by blists - more mailing lists