Re: [PATCH] xattr: NULL initialize name in simple_xattr_alloc
From: Al Viro
Date: Mon Mar 09 2020 - 18:31:52 EST
On Mon, Mar 09, 2020 at 12:30:07PM -0700, Joe Perches wrote:
> On Mon, 2020-03-09 at 11:37 -0700, Daniel Xu wrote:
> > It's preferable to initialize structs to a deterministic state.
>
> Thanks Daniel.
Not much point, TBH - there are only two callers, both assigning
that field very shortly. If you want to do it, do it right -
make that
simple_xattr_alloc(name, value, len)
with kfree(name) done on failure. And make the callers allocate
the name first. Simpler cleanup rules on failure exits that
way...