Re: [PATCH] 2.5.47: strdup()

Andrew Morton (akpm@digeo.com)
Fri, 15 Nov 2002 22:31:54 -0800


Olaf Dietsche wrote:
>
> +char *strdup(const char *s)
> +{
> + char *p = kmalloc(strlen(s) + 1, GFP_KERNEL);
> + if (p)
> + strcpy(p, s);
> +
> + return p;
> }

It's best to not assume GFP_KERNEL in there. Make the caller
pass in the required allocation mode.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/