[PATCH 5/5] crypto: Add LZO compression support to the crypto interface

Satyam Sharma satyam.sharma at gmail.com
Fri May 4 04:09:20 EDT 2007


On 5/1/07, Richard Purdie <rpurdie at openedhand.com> wrote:
> +static int lzo_init(struct crypto_tfm *tfm)
> +{
> +       struct lzo_ctx *ctx = crypto_tfm_ctx(tfm);
> +
> +       ctx->lzo_mem = vmalloc(LZO1X_MEM_COMPRESS);
> +
> +       if (!ctx->lzo_mem) {
> +               vfree(ctx->lzo_mem);

Heh. What's (why's) this? You _can_ {k, v}free NULL but doing so after
explicitly checking for it is ... ... insane!

> +               return -ENOMEM;

Yeah. Just return -ENOMEM; and be done with it.




More information about the linux-mtd mailing list