fs: fix fd table size alignment properly
[linux-2.6-microblaze.git] / fs / file.c
index c01c294..ee93173 100644 (file)
--- a/fs/file.c
+++ b/fs/file.c
@@ -303,10 +303,9 @@ static unsigned int sane_fdtable_size(struct fdtable *fdt, unsigned int max_fds)
        unsigned int count;
 
        count = count_open_files(fdt);
-       max_fds = ALIGN(max_fds, BITS_PER_LONG);
        if (max_fds < NR_OPEN_DEFAULT)
                max_fds = NR_OPEN_DEFAULT;
-       return min(count, max_fds);
+       return ALIGN(min(count, max_fds), BITS_PER_LONG);
 }
 
 /*