lkml.org 
[lkml]   [1998]   [Jul]   [7]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 7 Jul 1998 10:29:43 -0700 (MST)
Fromdalecki <>
SubjectAlan Cox patch 108
I just saw the following:

+/*
+ * Allocate an fd array, using get_free_page() if possible.
+ */
+struct file ** alloc_fd_array(int num)
+{
+       struct file **new_fds;
+       int size = num * sizeof(struct file *);
+
+       if (size == PAGE_SIZE)
+               new_fds = (struct file **) __get_free_page(GFP_KERNEL);
+       else
+               new_fds = (struct file **) kmalloc(size, GFP_KERNEL);
+       if (new_fds)
+               memset((void *) new_fds, 0, size);
+       return new_fds;
+}
and then....
+void free_fd_array(struct file **array, int num)
+{
+       int size = num * sizeof(struct file *);
+
+       if (size == PAGE_SIZE)
+               free_page((unsigned long) array);
+       else
+               kfree(array);
+}
+
Certainly somebody is asking for trouble...


		Marcin
=========================================================================
  In real life:         System Programmer at AIS AXON GmbH

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:43    [from the cache]
©2003-2008