[PATCH 2.6.20-rc2] [BUGFIX] drivers/atm/firestream.c: Fix infinite recursion when alignment passed is 0.
- From: Amit Choudhary <amit2030@xxxxxxxxx>
- Date: Sat, 30 Dec 2006 18:26:03 -0800
Description: Fix infinite recursion when alignment passed is 0 in function aligned_kmalloc(), in file drivers/atm/firestream.c. Also, a negative value for alignment does not make sense. Check for negative value too.
The function prototype is:
static void __devinit *aligned_kmalloc (int size, gfp_t flags, int alignment).
Signed-off-by: Amit Choudhary <amit2030@xxxxxxxxx>
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 9c67df5..2ba6b2e 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1385,7 +1385,7 @@ static void __devinit *aligned_kmalloc (
if (alignment <= 0x10) {
t = kmalloc (size, flags);
- if ((unsigned long)t & (alignment-1)) {
+ if ((unsigned long)t & ((alignment <= 0) ? 0 : (alignment-1))) {
printk ("Kmalloc doesn't align things correctly! %p\n", t);
kfree (t);
return aligned_kmalloc (size, flags, alignment * 4);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Prev by Date: Re: Regression in 2.6.19 and 2.6.20 for snd_hda_intel
- Next by Date: Re: Regression in 2.6.19 and 2.6.20 for snd_hda_intel
- Previous by thread: [PATCH] Open Firmware device tree virtual filesystem
- Next by thread: Re: [PATCH 2.6.20-rc2] [BUGFIX] drivers/atm/firestream.c: Fix infinite recursion when alignment passed is 0.
- Index(es):
Relevant Pages
- Re: Layout Hell-o
... the alignment boundary to be used for both 01s and 77s. ... This takes 3 bytes
and will be followed by one or more slack bytes ... character flags as 03 levels
in a record. ... (comp.lang.cobol) - Re: [BUG] slab debug vs. L1 alignement
... Perhaps we should remind ourselves what the alignment rules actually are ...
No two kmalloc allocations may share cache lines (otherwise data ... architecture.
... (Linux-Kernel) - Re: no need to check for NULL before calling kfree() -fs/ext2/
... GFP_KERNEL because i'm calling this function from interrupt context & it ...
I'm concerned abt why kmalloc ... Is it not necessary to check for NULL before calling
kfree() ?? ... > * Don't free memory not originally allocated by kmalloc ...
(Linux-Kernel) - Re: [PATCH 2.6] 7/7 replace snd_kmalloc_strdup by kstrdup
... >>However the code there already uses kfree, ... void snd_hidden_kfree;
... #define kmalloc(size, flags) snd_hidden_kmalloc ... * snd_kmalloc_strdup - copy
the string ... (Linux-Kernel) - Re: Slab corruption after unloading a module
... Can you reproduce this with 2.6.16? ... It seems to be a bug for kmalloc
and kfree. ... it may help to enable lots of kernel debug options. ... (Linux-Kernel)