lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 23 Oct 2006 09:35:51 +0300
From:	"Pekka Enberg" <penberg@...helsinki.fi>
To:	"Amit Choudhary" <amit2030@...il.com>
Cc:	"Linux Kernel" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2.6.19-rc2] sound/oss/i810_audio.c: check kmalloc() return value.

On 10/23/06, Amit Choudhary <amit2030@...il.com> wrote:
> @@ -2580,8 +2580,13 @@ static int i810_open(struct inode *inode
>                         if (card->states[i] == NULL) {
>                                 state = card->states[i] = (struct i810_state *)
>                                         kmalloc(sizeof(struct i810_state), GFP_KERNEL);
> -                               if (state == NULL)
> +                               if (state == NULL) {
> +                                       for (--i; i >= 0; i--) {
> +                                               kfree(card->states[i]);
> +                                               card->states[i] = NULL;
> +                                       }
>                                         return -ENOMEM;
> +                               }
>                                 memset(state, 0, sizeof(struct i810_state));
>                                 dmabuf = &state->dmabuf;
>                                 goto found_virt;

Looks wrong to me. We only allocate memory once in the loop (hint:
goto found_virt at the bottom here).
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ