Re: [PATCH v2]mempool.c : clean up type-casting twice

From: Ingo Molnar
Date: Sun Jul 05 2009 - 04:49:19 EST



* Figo.zhang <figo1802@xxxxxxxxx> wrote:

> clean up type-casting twice. "size_t" typedef as "unsigned long" in 64-bit system,
> and "unsigned int" in 32-bit system.
>
> Signed-off-by: Figo.zhang <figo1802@xxxxxxxxx>
> ---
> mm/mempool.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/mm/mempool.c b/mm/mempool.c
> index a46eb1b..bd22982 100644
> --- a/mm/mempool.c
> +++ b/mm/mempool.c
> @@ -303,7 +303,7 @@ EXPORT_SYMBOL(mempool_free_slab);
> */
> void *mempool_kmalloc(gfp_t gfp_mask, void *pool_data)
> {
> - size_t size = (size_t)(long)pool_data;
> + size_t size = (size_t) pool_data;
> return kmalloc(size, gfp_mask);
> }
> EXPORT_SYMBOL(mempool_kmalloc);

(Style detail: please dont add spaces to casts. That should be fixed
in mempool_kzalloc() too btw.)

Looks good otherwise - size_t ought to be long on all 64-bit
architectures.

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