public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] padata: add parenthesis in MAX_SEQ_NR macro
@ 2010-05-25 21:29 Dan Carpenter
  2010-05-26  6:32 ` Steffen Klassert
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2010-05-25 21:29 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Steffen Klassert, Henrik Kretzschmar, Tejun Heo, linux-kernel,
	kernel-janitors

MAX_SEQ_NR is used in padata_alloc_pd() like this:

        pd->max_seq_nr = (MAX_SEQ_NR / num_cpus) * num_cpus - 1;

It needs parenthesis or the divide by num_cpus takes precedence over the
subtraction.

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
Found by a static checker.  I don't really know this code.

diff --git a/kernel/padata.c b/kernel/padata.c
index b1c9857..ff8de1b 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -28,7 +28,7 @@
 #include <linux/slab.h>
 #include <linux/rcupdate.h>
 
-#define MAX_SEQ_NR INT_MAX - NR_CPUS
+#define MAX_SEQ_NR (INT_MAX - NR_CPUS)
 #define MAX_OBJ_NUM 1000
 
 static int padata_index_to_cpu(struct parallel_data *pd, int cpu_index)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] padata: add parenthesis in MAX_SEQ_NR macro
  2010-05-25 21:29 [patch] padata: add parenthesis in MAX_SEQ_NR macro Dan Carpenter
@ 2010-05-26  6:32 ` Steffen Klassert
  2010-06-03 10:19   ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Steffen Klassert @ 2010-05-26  6:32 UTC (permalink / raw)
  To: Dan Carpenter, Herbert Xu, Henrik Kretzschmar, Tejun Heo,
	linux-kernel, kernel-janitors

On Tue, May 25, 2010 at 11:29:13PM +0200, Dan Carpenter wrote:
> MAX_SEQ_NR is used in padata_alloc_pd() like this:
> 
>         pd->max_seq_nr = (MAX_SEQ_NR / num_cpus) * num_cpus - 1;
> 
> It needs parenthesis or the divide by num_cpus takes precedence over the
> subtraction.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Acked-by: Steffen Klassert <steffen.klassert@secunet.com>

Thanks,

Steffen

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] padata: add parenthesis in MAX_SEQ_NR macro
  2010-05-26  6:32 ` Steffen Klassert
@ 2010-06-03 10:19   ` Herbert Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2010-06-03 10:19 UTC (permalink / raw)
  To: Steffen Klassert
  Cc: Dan Carpenter, Henrik Kretzschmar, Tejun Heo, linux-kernel,
	kernel-janitors

On Wed, May 26, 2010 at 08:32:27AM +0200, Steffen Klassert wrote:
> On Tue, May 25, 2010 at 11:29:13PM +0200, Dan Carpenter wrote:
> > MAX_SEQ_NR is used in padata_alloc_pd() like this:
> > 
> >         pd->max_seq_nr = (MAX_SEQ_NR / num_cpus) * num_cpus - 1;
> > 
> > It needs parenthesis or the divide by num_cpus takes precedence over the
> > subtraction.
> > 
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> Acked-by: Steffen Klassert <steffen.klassert@secunet.com>

Applied.  Thanks!
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-06-03 10:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25 21:29 [patch] padata: add parenthesis in MAX_SEQ_NR macro Dan Carpenter
2010-05-26  6:32 ` Steffen Klassert
2010-06-03 10:19   ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox