Skip to content

Commit

Permalink
[PATCH] propagate __nocast annotations
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Dobriyan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Alexey Dobriyan authored and Linus Torvalds committed Jul 8, 2005
1 parent b84c215 commit 0db925a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions include/linux/gfp.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct vm_area_struct;
* GFP bitmasks..
*/
/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */
#define __GFP_DMA 0x01
#define __GFP_HIGHMEM 0x02
#define __GFP_DMA 0x01u
#define __GFP_HIGHMEM 0x02u

/*
* Action modifiers - doesn't change the zoning
Expand Down
4 changes: 2 additions & 2 deletions include/linux/slab.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extern void *kmem_cache_alloc(kmem_cache_t *, unsigned int __nocast);
extern void kmem_cache_free(kmem_cache_t *, void *);
extern unsigned int kmem_cache_size(kmem_cache_t *);
extern const char *kmem_cache_name(kmem_cache_t *);
extern kmem_cache_t *kmem_find_general_cachep(size_t size, int gfpflags);
extern kmem_cache_t *kmem_find_general_cachep(size_t size, unsigned int __nocast gfpflags);

/* Size description struct for general caches. */
struct cache_sizes {
Expand Down Expand Up @@ -105,7 +105,7 @@ extern unsigned int ksize(const void *);

#ifdef CONFIG_NUMA
extern void *kmem_cache_alloc_node(kmem_cache_t *, int flags, int node);
extern void *kmalloc_node(size_t size, int flags, int node);
extern void *kmalloc_node(size_t size, unsigned int __nocast flags, int node);
#else
static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node)
{
Expand Down
2 changes: 1 addition & 1 deletion include/linux/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ extern int memcmp(const void *,const void *,__kernel_size_t);
extern void * memchr(const void *,int,__kernel_size_t);
#endif

extern char *kstrdup(const char *s, int gfp);
extern char *kstrdup(const char *s, unsigned int __nocast gfp);

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion mm/mempool.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask)
void *element;
unsigned long flags;
wait_queue_t wait;
int gfp_temp;
unsigned int gfp_temp;

might_sleep_if(gfp_mask & __GFP_WAIT);

Expand Down
12 changes: 7 additions & 5 deletions mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,8 @@ static inline struct array_cache *ac_data(kmem_cache_t *cachep)
return cachep->array[smp_processor_id()];
}

static inline kmem_cache_t *__find_general_cachep(size_t size, int gfpflags)
static inline kmem_cache_t *__find_general_cachep(size_t size,
unsigned int __nocast gfpflags)
{
struct cache_sizes *csizep = malloc_sizes;

Expand All @@ -608,7 +609,8 @@ static inline kmem_cache_t *__find_general_cachep(size_t size, int gfpflags)
return csizep->cs_cachep;
}

kmem_cache_t *kmem_find_general_cachep(size_t size, int gfpflags)
kmem_cache_t *kmem_find_general_cachep(size_t size,
unsigned int __nocast gfpflags)
{
return __find_general_cachep(size, gfpflags);
}
Expand Down Expand Up @@ -2100,7 +2102,7 @@ cache_alloc_debugcheck_before(kmem_cache_t *cachep, unsigned int __nocast flags)
#if DEBUG
static void *
cache_alloc_debugcheck_after(kmem_cache_t *cachep,
unsigned long flags, void *objp, void *caller)
unsigned int __nocast flags, void *objp, void *caller)
{
if (!objp)
return objp;
Expand Down Expand Up @@ -2442,7 +2444,7 @@ void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int nodeid)
}
EXPORT_SYMBOL(kmem_cache_alloc_node);

void *kmalloc_node(size_t size, int flags, int node)
void *kmalloc_node(size_t size, unsigned int __nocast flags, int node)
{
kmem_cache_t *cachep;

Expand Down Expand Up @@ -3094,7 +3096,7 @@ unsigned int ksize(const void *objp)
* @s: the string to duplicate
* @gfp: the GFP mask used in the kmalloc() call when allocating memory
*/
char *kstrdup(const char *s, int gfp)
char *kstrdup(const char *s, unsigned int __nocast gfp)
{
size_t len;
char *buf;
Expand Down

0 comments on commit 0db925a

Please sign in to comment.