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: <alpine.DEB.2.00.0903231451040.3578@gandalf.stny.rr.com>
Date:	Mon, 23 Mar 2009 14:51:49 -0400 (EDT)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Frederic Weisbecker <fweisbec@...il.com>
cc:	Tom Zanussi <tzanussi@...il.com>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Ingo Molnar <mingo@...e.hu>
Subject: Re: [PATCH 1/4] tracing: add run-time field descriptions for event
 filtering


On Sun, 22 Mar 2009, Frederic Weisbecker wrote:
> >  static DEFINE_MUTEX(event_mutex);
> >  
> > +int trace_define_field(struct ftrace_event_call *call, char *type,
> > +		       char *name, int offset, int size)
> > +{
> > +	struct ftrace_event_field *field;
> > +
> > +	field = kmalloc(sizeof(*field), GFP_KERNEL);
> > +	if (!field)
> > +		goto err;
> > +	field->name = kstrdup(name, GFP_KERNEL);
> > +	if (!field->name)
> > +		goto err;
> > +	field->type = kstrdup(type, GFP_KERNEL);
> > +	if (!field->type)
> > +		goto err;
> > +	field->offset = offset;
> > +	field->size = size;
> > +	list_add(&field->link, &call->fields);
> > +
> > +	return 0;
> > +err:
> > +	if (field) {
> > +		kfree(field->name);
> > +		kfree(field->type);
> 
> 
> You need kzalloc to allocate field.
> With kmalloc, field will point to random filled memory
> after a fresh allocation.
> 
> Imagine this path:
> 
> if (!field->name)
> 	goto err;
> ...
> err:
> 	kfree(field->name) <- field->name = NULL, correct
> 	kfree(field->type) <- field->type = ?
> 

Looks like Frederic got to you first ;-)

-- Steve

> 
> > +	}
> > +	kfree(field);
> > +	return -ENOMEM;
> > +}
> > +
--
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