Re: [PATCH] ALSA: Remove subsystem-specific malloc (1/8)

From: Chris Wright
Date: Wed Jun 09 2004 - 16:06:08 EST


* Pekka Enberg (penberg@xxxxxxxxxxxxxx) wrote:
> +void *kcalloc(size_t n, size_t size, int flags)
> +{
> + if (n != 0 && size > INT_MAX / n)
> + return NULL;

Yup, I forgot to add divide by zero check.

> + void *ret = kmalloc(n * size, flags);

This is only C99, and will make some compilers spit up warning.

thanks,
-chris
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
-
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/