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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090322195033.GA15002@elte.hu>
Date:	Sun, 22 Mar 2009 20:50:33 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Frederic Weisbecker <fweisbec@...il.com>
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


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

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.

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