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: <20171108154051.GB4333@kernel.org>
Date:   Wed, 8 Nov 2017 12:40:51 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Jiri Olsa <jolsa@...hat.com>
Cc:     Andi Kleen <andi@...stfloor.org>, jolsa@...nel.org,
        linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 1/2] perf, tools: Enable type checking for
 perf_evsel_config_term types

Em Tue, Oct 24, 2017 at 09:38:49AM +0200, Jiri Olsa escreveu:
> On Fri, Oct 20, 2017 at 01:27:54PM -0700, Andi Kleen wrote:
> > From: Andi Kleen <ak@...ux.intel.com>
> > 
> > Use a typed enum for the perf_evsel_config_term type enum.
> > This allows gcc to do much stronger type checks, and also
> > check for missing case statements.
> > 
> > I removed the unused _MAX member from the number.
> > 
> > It found one missing case. I'm not sure it's a real problem,
> > so I just turned it into a BUG_ON for now.
> > 
> > Signed-off-by: Andi Kleen <ak@...ux.intel.com>
> > ---
> >  tools/perf/util/evsel.c | 2 ++
> >  tools/perf/util/evsel.h | 5 ++---
> >  2 files changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> > index f894893c203d..d1f63b93bf69 100644
> > --- a/tools/perf/util/evsel.c
> > +++ b/tools/perf/util/evsel.c
> > @@ -775,6 +775,8 @@ static void apply_config_terms(struct perf_evsel *evsel,
> >  		case PERF_EVSEL__CONFIG_TERM_OVERWRITE:
> >  			attr->write_backward = term->val.overwrite ? 1 : 0;
> >  			break;
> > +		case PERF_EVSEL__CONFIG_TERM_DRV_CFG:
> > +			BUG_ON(1);
> >  		default:
> >  			break;
> >  		}
> > diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
> > index db658785d828..6728d8d6e513 100644
> > --- a/tools/perf/util/evsel.h
> > +++ b/tools/perf/util/evsel.h
> > @@ -37,7 +37,7 @@ struct cgroup_sel;
> >   * It is allocated within event parsing and attached to
> >   * perf_evsel::config_terms list head.
> >  */
> > -enum {
> > +enum period_type {
> 
> seems ok, but I'm puzzled with the 'period_type' name
> I think it should be more like 'term_type' or something

Ok, renamed it to term_type and added your Acked-by,

- ARnaldo
 
> jirka
> 
> 
> >  	PERF_EVSEL__CONFIG_TERM_PERIOD,
> >  	PERF_EVSEL__CONFIG_TERM_FREQ,
> >  	PERF_EVSEL__CONFIG_TERM_TIME,
> > @@ -48,12 +48,11 @@ enum {
> >  	PERF_EVSEL__CONFIG_TERM_OVERWRITE,
> >  	PERF_EVSEL__CONFIG_TERM_DRV_CFG,
> >  	PERF_EVSEL__CONFIG_TERM_BRANCH,
> > -	PERF_EVSEL__CONFIG_TERM_MAX,
> >  };
> >  
> >  struct perf_evsel_config_term {
> >  	struct list_head	list;
> > -	int	type;
> > +	enum period_type	type;
> >  	union {
> >  		u64	period;
> >  		u64	freq;
> > -- 
> > 2.13.6
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ