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  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20071129.122245.-1300543769.kouish@swc.toshiba.co.jp>
Date:	Thu, 29 Nov 2007 12:22:45 +0900 (JST)
From:	Ishizaki Kou <kou.ishizaki@...hiba.co.jp>
To:	gorcunov@...il.com
Cc:	michael@...erman.id.au, olof@...om.net, linuxppc-dev@...abs.org,
	paulus@...ba.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] PPC: CELLEB - fix potential NULL pointer dereference

Cyrill Gorcunov <gorcunov@...il.com> wrote:
> On 11/28/07, Cyrill Gorcunov <gorcunov@...il.com> wrote:
> > On 11/28/07, Michael Ellerman <michael@...erman.id.au> wrote:
> > > On Mon, 2007-11-26 at 10:46 +0300, Cyrill Gorcunov wrote:
> > > > This patch adds checking for NULL value returned to prevent possible
> > > > NULL pointer dereference.
> > > > Also two unneeded 'return' are removed.
> > > >
> > > > Signed-off-by: Cyrill Gorcunov <gorcunov@...il.com>
> > > > ---
> > > > Any comments are welcome.
> > >
> > > I guess it's good to be paranoid, but this is a little verbose:
> > >
> > >        wi0 = of_get_property(node, "device-id", NULL);
> > > +       if (unlikely((!wi0))) {
> > > +               printk(KERN_ERR "PCI: device-id not found.\n");
> > > +               goto error;
> > > +       }
> > >        wi1 = of_get_property(node, "vendor-id", NULL);
> > > +       if (unlikely((!wi1))) {
> > > +               printk(KERN_ERR "PCI: vendor-id not found.\n");
> > > +               goto error;
> > > +       }
> > >        wi2 = of_get_property(node, "class-code", NULL);
> > > +       if (unlikely((!wi2))) {
> > > +               printk(KERN_ERR "PCI: class-code not found.\n");
> > > +               goto error;
> > > +       }
> > >        wi3 = of_get_property(node, "revision-id", NULL);
> > > +       if (unlikely((!wi3))) {
> > > +               printk(KERN_ERR "PCI: revision-id not found.\n");
> > > +               goto error;
> > > +       }
> > >
> > > Perhaps instead:
> > >
> > >        wi0 = of_get_property(node, "device-id", NULL);
> > >        wi1 = of_get_property(node, "vendor-id", NULL);
> > >        wi2 = of_get_property(node, "class-code", NULL);
> > >        wi3 = of_get_property(node, "revision-id", NULL);
> > >
> > >       if (!wi0 || !wi1 || !wi2 || !wi3) {
> > >               printk(KERN_ERR "PCI: Missing device tree properties.\n");
> > >               goto error;
> > >       }
> >
> > Hi Michael, yes that is much better (actually I was doubt about what form of
> > which the checking style to use - your form is much compact but mine does
> > show where *exactly* the problem appeared). So 'case that is the fake driver
> > your form is preferred ;) Ishizaki, could you use Michael's part then?
> >
> > >
> > >
> > > cheers
> > >
> > > --
> > > Michael Ellerman
> > > OzLabs, IBM Australia Development Lab
> > >
> > > wwweb: http://michael.ellerman.id.au
> > > phone: +61 2 6212 1183 (tie line 70 21183)
> > >
> > > We do not inherit the earth from our ancestors,
> > > we borrow it from our children. - S.M.A.R.T Person
> > >
> > >
> >
> > Cyrill
> >
> Ishizaki I can update the patch if you needed. Should I?
> 
> Cyrill

There is no problem to use Michael's part, and I also prefer simple
one like this.

Cyrill, would you please update your patch?

Best regards,
Kou Ishizaki
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ