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]
Date:	Tue, 15 Jan 2013 10:31:05 -0800
From:	Joe Perches <joe@...ches.com>
To:	James Hogan <james.hogan@...tec.com>
Cc:	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	Mike Turquette <mturquette@...aro.org>
Subject: Re: [PATCH 1/1] clk-divider: fix is_power_of_two()

On Tue, 2013-01-15 at 10:28 +0000, James Hogan wrote:
> The macro is_power_of_two() in clk-divider.c was defined as !(i & ~i)
> which is always true. Correct it to !(i & (i - 1)).
[]
> diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
[]
> @@ -29,8 +29,8 @@
[]
> -#define div_mask(d)	((1 << (d->width)) - 1)
> -#define is_power_of_two(i)	!(i & ~i)
> +#define div_mask(d)	((1 << ((d)->width)) - 1)
> +#define is_power_of_two(i)	(!((i) & ((i) - 1)))

Use is_power_of_2 in log2.h instead?


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