On Fri, Jan 26, 2024 at 01:37:28PM +0800, Herbert Xu wrote: > On Sun, Jan 21, 2024 at 06:50:39PM +0100, Lukas Wunner wrote: > > > > * x509_cert_parse() now checks that "cert" is not an ERR_PTR() before > > calling x509_free_certificate() at end of scope. The compiler doesn't > > know that kzalloc() never returns an ERR_PTR(). > > How about moving the IS_ERR_OR_NULL check into x509_free_certificate > itself so that you can always call it? Thanks for the suggestion. Indeed the NULL check is unnecessary as x509_free_certificate() already checks that. So in v2 I'm only checking for !IS_ERR() in the DEFINE_FREE() clause and that avoids the gratuitous NULL pointer checks at end of scope. Lukas