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: <1498147673.24295.6.camel@perches.com>
Date:   Thu, 22 Jun 2017 09:07:53 -0700
From:   Joe Perches <joe@...ches.com>
To:     laurentiu.tudor@....com, gregkh@...uxfoundation.org,
        stuyoder@...il.com
Cc:     devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
        marc.zyngier@....com, agraf@...e.de, arnd@...db.de,
        ioana.ciornei@....com, ruxandra.radulescu@....com,
        bharat.bhushan@....com, catalin.horghidan@....com,
        leoyang.li@....com, roy.pledge@....com,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 01/14] staging: fsl-mc: drop macros with possible side
 effects

On Thu, 2017-06-22 at 16:35 +0300, laurentiu.tudor@....com wrote:
> From: Laurentiu Tudor <laurentiu.tudor@....com>
> 
> Several macros were triggering this checkpatch.pl warning:
>   "Macro argument reuse '$arg' - possible side-effects?"
> Fix the warning by turning them into real functions.

good idea and

> diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c
[]
> +static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev,
> +				struct dprc_obj_desc *obj_desc)
> +{
> +	return !strcmp(mc_dev->obj_desc.type, obj_desc->type) &&
> +		mc_dev->obj_desc.id == obj_desc->id;
> +}

I'd reverse the test order and do the strcmp after the comparison

	return mc_dev->obj_desc.id == obj_desc->id &&
	       !strcmp(mc_dev->obj_desc.type, obj_desc->type);

[]

> +static bool __must_check fsl_mc_is_allocatable(const char *obj_type)
> +{
> +	return strcmp(obj_type, "dpbp") == 0 ||
> +	       strcmp(obj_type, "dpmcp") == 0 ||
> +	       strcmp(obj_type, "dpcon") == 0;
> +}

please be consistent in using either == 0 or !
when using strcmp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ