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] [day] [month] [year] [list]
Date:   Tue, 11 Jul 2017 08:42:46 -0700
From:   Joe Perches <joe@...ches.com>
To:     Lynn Lei <lynnl.yet@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] leds: leds-aat1290.c: enclosed arithmetic expression
 macro

On Tue, 2017-07-11 at 23:23 +0800, Lynn Lei wrote:
> Fixed the unenclosed complex values macro issue generated by
> scripts/checkpatch.pl:
> 	ERROR: Macros with complex values should be enclosed in parentheses
[]
> diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
[]
> @@ -35,7 +35,7 @@
>  #define AAT1290_MM_CURRENT_RATIO_ADDR	20
>  #define AAT1290_MM_TO_FL_1_92		1
>  
> -#define AAT1290_MM_TO_FL_RATIO		1000 / 1920
> +#define AAT1290_MM_TO_FL_RATIO		(1000 / 1920)
>  #define AAT1290_MAX_MM_CURRENT(fl_max)	(fl_max * AAT1290_MM_TO_FL_RATIO)

Nope, try again.

Look at one use of this macro and see how it could be
improved.  Think to yourself is AAT1290_MM_FL_RATIO a
useful define.  Think how adding parenthesis changes
AAT1290_MAX_MM_CURRENT.

checkpatch isn't always correct, but it can help
improved the code even if the messages it emits aren't
always intelligible.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ