Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.6.25-git14 /init/initramfs.c

Filename:/init/initramfs.c
Lines Added:10
Lines Deleted:10
Also changed in: (Previous) 2.6.25  2.6.25-rc9  2.6.25-rc8  2.6.25-rc7  2.6.25-rc6  2.6.25-rc5-git7 
(Following) 2.6.25-git15  2.6.25-git16  2.6.25-git17  2.6.25-git18  2.6.25-git19  2.6.25-git20 

Location
[  2.6.25-git14
  [  init
     o  initramfs.c

Patch

diff --git a/init/initramfs.c b/init/initramfs.c
index d53fee8..8eeeccb 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -57,7 +57,7 @@ static char __init *find_link(int major, int minor, int ino,
          continue;
       return (*p)->name;
    }
-   q = (struct hash *)malloc(sizeof(struct hash));
+   q = kmalloc(sizeof(struct hash), GFP_KERNEL);
    if (!q)
       panic("can't allocate link hash entry");
    q->major = major;
@@ -77,7 +77,7 @@ static void __init free_hash(void)
       while (*p) {
          q = *p;
          *p = q->next;
-         free(q);
+         kfree(q);
       }
    }
 }
@@ -445,10 +445,10 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
 {
    int written;
    dry_run = check_only;
-   header_buf = malloc(110);
-   symlink_buf = malloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1);
-   name_buf = malloc(N_ALIGN(PATH_MAX));
-   window = malloc(WSIZE);
+   header_buf = kmalloc(110, GFP_KERNEL);
+   symlink_buf = kmalloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1, GFP_KERNEL);
+   name_buf = kmalloc(N_ALIGN(PATH_MAX), GFP_KERNEL);
+   window = kmalloc(WSIZE, GFP_KERNEL);
    if (!window || !header_buf || !symlink_buf || !name_buf)
       panic("can't allocate buffers");
    state = Start;
@@ -484,10 +484,10 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
       buf += inptr;
       len -= inptr;
    }
-   free(window);
-   free(name_buf);
-   free(symlink_buf);
-   free(header_buf);
+   kfree(window);
+   kfree(name_buf);
+   kfree(symlink_buf);
+   kfree(header_buf);
    return message;
 }
 


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.