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]
Message-ID: <20090322195424.GG6002@nowhere>
Date:	Sun, 22 Mar 2009 20:54:25 +0100
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	Tom Zanussi <tzanussi@...il.com>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH 4/4] tracing: add per-subsystem filtering

On Sun, Mar 22, 2009 at 08:50:33PM +0100, Ingo Molnar wrote:
> 
> * Frederic Weisbecker <fweisbec@...il.com> wrote:
> 
> > > +int filter_add_subsystem_pred(struct event_subsystem *system,
> > > +			      struct filter_pred *pred)
> > > +{
> > > +	struct ftrace_event_call *call = __start_ftrace_events;
> > > +	struct filter_pred *event_pred;
> > > +	int i;
> > > +
> > > +	if (system->preds && !pred->compound)
> > > +		filter_free_subsystem_preds(system);
> > > +
> > > +	if (!system->preds) {
> > > +		system->preds = kzalloc(MAX_FILTER_PRED * sizeof(pred),
> > > +					GFP_KERNEL);
> > > +		if (!system->preds)
> > > +			return -ENOMEM;
> > > +	}
> > > +
> > > +	for (i = 0; i < MAX_FILTER_PRED; i++) {
> > > +		if (!system->preds[i]) {
> > > +			system->preds[i] = pred;
> > > +			break;
> > > +		}
> > > +		if (i == MAX_FILTER_PRED - 1)
> > > +			return -EINVAL;
> > 
> > 
> > Shouldn't it be i == MAX_FILTER_PRED ?
> 
> Here we search for a free slot in the array of sub-expressions of 
> the subsystem level filters. That condition cannot even be true 
> inside a 'i < MAX_FILTER_PRED' loop.


Darn, I should sleep more!

 
> Checking for i==MAX would be fine if done outside of the loop - and 
> should probably be done that way. But the code is correct this way 
> too i think.
> 


Yes, at least it's harmless.

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