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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 24 Feb 2014 10:16:25 -0800
From:	Joe Perches <joe@...ches.com>
To:	Linus Walleij <linus.walleij@...aro.org>
Cc:	Mark Brown <broonie@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	linaro-kernel <linaro-kernel@...ts.linaro.org>,
	Mark Brown <broonie@...aro.org>
Subject: Re: [PATCH] pinctrl: Avoid kasprintf/kfree

On Mon, 2014-02-24 at 10:49 +0100, Linus Walleij wrote:
> On Thu, Jan 30, 2014 at 9:37 PM, Joe Perches <joe@...ches.com> wrote:
> > Avoid an unnecessary allocation/free by using stack instead.
> >
> > Signed-off-by; Joe Perches <joe@...ches.com>
> 
> Hm.
> 
> > +       char propname[9 + sizeof(int) * 2 + 4] = "pinctrl-";
> 
> If you absolutely want to do this you have to
> 
> #define PINCTRL_PREFIX "pinctrl-"
> 
> char propname[strlen(PINCTRL_PREFIX) + sizeof(int)*2 + 4] = PINCTRL_PREFIX;
> 
> Then add a comment above stating why you add 4.

No, I don't really.

> > This allocation seems unnecessary and the kasprintf isn't
> > checked for non-null, so maybe this is better.
> 
> Another option would be to just add a NULL-check? This is
> definately not on a performance-critical path.

It's a defect not to check the kasprintf return before
writing through it.

I submitted what I think appropriate.

Fix it as you choose.  Or not.

cheers, Joe

--
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