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]
Date:	Thu, 23 Jul 2015 19:11:12 +1000
From:	Michael Ellerman <mpe@...erman.id.au>
To:	Madhavan Srinivasan <maddy@...ux.vnet.ibm.com>
Cc:	Daniel Axtens <dja@...ens.net>, linux-kernel@...r.kernel.org,
	Stephane Eranian <eranian@...gle.com>,
	Paul Mackerras <paulus@...ba.org>,
	Anton Blanchard <anton@...ba.org>,
	Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>,
	linuxppc-dev@...ts.ozlabs.org,
	Anshuman Khandual <khandual@...ux.vnet.ibm.com>
Subject: Re: [PATCH v5 4/7] powerpc/powernv: detect supported nest pmus and
 its events

On Thu, 2015-07-23 at 11:33 +0530, Madhavan Srinivasan wrote:
> 
> On Wednesday 22 July 2015 09:37 AM, Daniel Axtens wrote:
> >  
> >>  static struct perchip_nest_info p8_nest_perchip_info[P8_NEST_MAX_CHIPS];
> >> +static struct nest_pmu *per_nest_pmu_arr[P8_NEST_MAX_PMUS];
> >> +
> >> +static int nest_event_info(struct property *pp, char *name,
> >> +			struct nest_ima_events *p8_events, int string, u32 val)
> > 'int string' is a bit confusing. 'bool is_string' might be clearer, but
> > I think it would be even better still to have different functions for
> > string and non-string cases, especially because you only need val in the
> > non-string case.
> 
> I would perfer to be a single function, since most of the code is same
> just of the sting or val part. yes. We can make is as is_string and will
> add comment explaining what is done here? 

I think Daniel's right, it would be better as two functions.

The only part that is common after the if (string) check is the
p8_events->ev_value = buf assignment.

So you should be able to keep all the code up to the if (string) check in a
shared function and just have two wrappers that use it.

cheers


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