fs: Fix close_on_exec pointer in alloc_fdtable
Bobby Powers [Wed, 22 Feb 2012 05:29:47 +0000 (00:29 -0500)]
alloc_fdtable allocates space for the open_fds and close_on_exec
bitfields together, as 2 * nr / BITS_PER_BYTE.  close_on_exec needs to
point to open_fds + nr / BITS_PER_BYTE, not open_fds + nr /
BITS_PER_LONG, as introducted in 1fd36adc: Replace the fd_sets in
struct fdtable with an array of unsigned longs.

Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
Link: http://lkml.kernel.org/r/1329888587-3087-1-git-send-email-bobbypowers@gmail.com
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>

fs/file.c

index 2d479dd..171f6b4 100644 (file)
--- a/fs/file.c
+++ b/fs/file.c
@@ -179,7 +179,7 @@ static struct fdtable * alloc_fdtable(unsigned int nr)
        if (!data)
                goto out_arr;
        fdt->open_fds = data;
-       data += nr / BITS_PER_LONG;
+       data += nr / BITS_PER_BYTE;
        fdt->close_on_exec = data;
        fdt->next = NULL;