Skip to contentSkip to conversation

mm/slab_common.c:385:13: sparse: restricted gfp_t degrades to integer

PATCH In review Fengguang Wu 3 participants 3 messages Feb 2, 2013 – Feb 4, 2013 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 510bae53.+nWBFPQ3bGiTzPs/%[email protected]

A message that is not in the archive (sent off-list or not yet received): 0000013c971ab472-8542127a-19e8-4f6a-8b7e-5f5ab8bcd8fd-000000@email.amazonses.com

#2 lore raw
Quoted 15 lines · Christoph Lameter
Quoted 12 lines · kbuild test robot
   374		int index;
   375
   376		if (size <= 192) {
   377			if (!size)
   378				return ZERO_SIZE_PTR;
   379
   380			index = size_index[size_index_elem(size)];
   381		} else
   382			index = fls(size - 1);
   383
   384	#ifdef CONFIG_ZONE_DMA
Quoted 1 line

385 if (unlikely((flags & SLAB_CACHE_DMA)))

Quoted 1 line

Should flags be cast to integer before doing the & operation?

It seems not easy to quiet this warning..

(unsigned long)flags & SLAB_CACHE_DMA /c/wfg/sound/mm/slab_common.c:385:13: sparse: cast from restricted gfp_t

flags & (gfp_t)SLAB_CACHE_DMA /c/wfg/sound/mm/slab_common.c:385:13: sparse: cast to restricted gfp_t

Thanks,
Fengguang

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw

PATCH 1/1 mm/sl[au]b: correct allocation type check in kmalloc_slab()

commit "slab: Common Kmalloc cache determination" made mistake in kmalloc_slab(). SLAB_CACHE_DMA is for kmem_cache creation, not for allocation. For allocation, we should use GFP_XXX to identify type of allocation. So, change SLAB_CACHE_DMA to GFP_DMA.

mm/slab_common.c +1 -1
index 6d73f0b..2f0e7d5 100644
@@ -382,7 +382,7 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags)
 		index = fls(size - 1);
 
 #ifdef CONFIG_ZONE_DMA
-	if (unlikely((flags & SLAB_CACHE_DMA)))
+	if (unlikely((flags & GFP_DMA)))
 		return kmalloc_dma_caches[index];
 
 #endif
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v1 1/1
#4 lore raw

Re: [PATCH for-next] mm/sl[au]b: correct allocation type check in kmalloc_slab()

Quoted 4 lines · Joonsoo Kim

commit "slab: Common Kmalloc cache determination" made mistake in kmalloc_slab(). SLAB_CACHE_DMA is for kmem_cache creation, not for allocation. For allocation, we should use GFP_XXX to identify type of allocation. So, change SLAB_CACHE_DMA to GFP_DMA.

Correct.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>