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] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 4 Dec 2013 14:09:51 +0000
From:	Mark Rutland <mark.rutland@....com>
To:	Alex Elder <alex.elder@...aro.org>
Cc:	Christian Daudt <bcm@...thebug.org>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Pawel Moll <Pawel.Moll@....com>,
	"rob.herring@...xeda.com" <rob.herring@...xeda.com>,
	Rob Landley <rob@...dley.net>,
	Russell King <linux@....linux.org.uk>,
	Stephen Warren <swarren@...dotorg.org>,
	Mike Turquette <mturquette@...aro.org>,
	"bcm-kernel-feedback-list@...adcom.com" 
	<bcm-kernel-feedback-list@...adcom.com>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] clk: bcm281xx: add initial clock framework support

On Wed, Dec 04, 2013 at 01:57:39PM +0000, Alex Elder wrote:
> On 12/04/2013 07:06 AM, Alex Elder wrote:
> >>> +       name_size = strlen(node->name) + 1;
> >>> >> +       ccu = kzalloc(sizeof(*ccu) + name_size, GFP_KERNEL);
> >>> >> +       if (!ccu) {
> >>> >> +               pr_err("%s: unable to map allocate CCU struct for %s\n",
> >>> >> +                       __func__, node->name);
> >>> >> +               return;
> >>> >> +       }
> >>> >> +       memcpy((char *)ccu->name, node->name, name_size);
> >> > 
> >> > You could simplify this with kstrdup.
> > You are correct, and I will make that change.  I think at
> > one point I needed the length but that doesn't appear to
> > be the case here.
> 
> On second thought, no, you may have missed what was happening here.
> I was avoiding two kmallocs() by setting aside space at the end
> of the structure to hold its name.  It may seem silly, but this
> avoids a possible (well, conceivable) failure case.

Yes, I'd misunderstood. Sorry about that.

> 
> However, based on your earlier question about "what about freeing
> ccu->name?" I am going to use kstrdup() here.  I'd rather the code
> put you at ease than look weird just to avoid an unlikely failure.

I'm happy either way.

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