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]
Message-ID: <20110427140333.GA22909@home.goodmis.org>
Date:	Wed, 27 Apr 2011 10:03:33 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Rafa?? Mi??ecki <zajec5@...il.com>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Andy Botting <andy@...ybotting.com>
Subject: Re: Crash with kfree(null) on MacBook? kobject_set_name_vargs

On Mon, Apr 11, 2011 at 09:38:02PM +0200, Rafa?? Mi??ecki wrote:
> Thank you Linus, now when you made it clear to me that NULL ~!= NULL,
> I realized I didn't zeroed struct which contains struct dev.
> 
> struct axi_device core;
> vs.
> struct axi_device core = { };

The two are identical. If they are declared as globals or static. As
globals and static variables are initialized to zero at start up.

Is this on the stack or global? If on the stack, you need the
initializer, if it is global you do not.

IOW:

struct axi_device core;
static struct axi_device core;

void func(void)
{
	static struct axi_device core;
[...]

All the above is OK with no initializer.

void func(void)
{
	struct axi_device core = {};


This does need an initializer, but gcc should complain if you use core
without initializing.

-- Steve

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