lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 5 Mar 2019 10:30:12 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc:     "Cao, Bingbu" <bingbu.cao@...el.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Zhi, Yong" <yong.zhi@...el.com>,
        "linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
        "devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] media: staging/intel-ipu3: reduce kernel stack usage

On Tue, Mar 5, 2019 at 9:47 AM Sakari Ailus
<sakari.ailus@...ux.intel.com> wrote:
> On Tue, Mar 05, 2019 at 09:40:24AM +0100, Arnd Bergmann wrote:
> > On Tue, Mar 5, 2019 at 8:53 AM Sakari Ailus <sakari.ailus@...ux.intel.com> wrote:
> > > On Tue, Mar 05, 2019 at 12:25:18AM +0000, Cao, Bingbu wrote:
> >
> > > > >     struct v4l2_pix_format_mplane *const in =
> > > > >                                     &q[IPU3_CSS_QUEUE_IN].fmt.mpix;
> > > > >     struct v4l2_pix_format_mplane *const out = @@ -1753,6 +1754,11 @@
> > > > > int imgu_css_fmt_try(struct imgu_css *css,
> > > > >                                     &q[IPU3_CSS_QUEUE_VF].fmt.mpix;
> > > > >     int i, s, ret;
> > > > >
> > > > > +   if (!q) {
> > > > > +           ret = -ENOMEM;
> > > > > +           goto out;
> > > > > +   }
> > > > [Cao, Bingbu]
> > > > The goto here is wrong, you can just report an error, and I prefer it is next to the alloc.
> > >
> > > I agree, the goto is just not needed.
> >
> > Should I remove all the gotos then and do an explicit kfree() in each
> > error path?
> >
> > I'd prefer not to mix the two styles, as that can lead to subtle mistakes
> > when the code is refactored again.
>
> In this case there's no need for kfree as q is NULL. Goto is often useful
> if you need to do things to undo stuff that was done earlier in the
> function but it's not the case here. I prefer keeping the rest gotos.

Ok, I'll send an updated patch the way you suggested then.

     Arnd

Powered by blists - more mailing lists