[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Mini-OS: fix 9pfs frontend error path



Jürgen Groß, le mar. 06 févr. 2024 16:37:17 +0100, a ecrit:
> On 06.02.24 16:26, Samuel Thibault wrote:
> > Juergen Gross, le mar. 06 févr. 2024 07:17:21 +0100, a ecrit:
> > > The early error exit in p9_stat() returns without zeroing the p9_stat
> > > buffer, resulting in free() being called with an uninitialized pointer.
> > > 
> > > Fix that by doing the zeroing first.
> > 
> > This is not coherent with the usual conventions: when a function fails,
> > it is supposed not to have done anything, and thus the caller shouldn't
> > have to clean anything.
> > 
> > I.e. i'd rather see the free_stat() call be put after the check for
> > an error returned by p9_stat.
> 
> I can do that, but this would require two calls of free_stat() (one in
> p9_stat() in an error case reported via req->result, and one in the
> caller of p9_stat() in case of no error).

Indeed, but that still looks more coherent with usual conventions.

Samuel



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.