Re: [PATCH] proc: make proc entry's len "unsigned int"

From: Joe Perches
Date: Fri Nov 26 2010 - 18:58:09 EST


On Fri, 2010-11-26 at 23:10 +0200, Alexey Dobriyan wrote:
> Space is not really conserved, because of natural alignment for the next field.

It can be. Depends on the arch.

> Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>
[]
> --- a/include/linux/proc_fs.h
> +++ b/include/linux/proc_fs.h
> @@ -50,7 +50,7 @@ typedef int (write_proc_t)(struct file *file, const char __user *buffer,
>
> struct proc_dir_entry {
> unsigned int low_ino;
> - unsigned short namelen;
> + unsigned int namelen;
> const char *name;
> mode_t mode;
> nlink_t nlink;

mode_t is unsigned short on many platforms.

Layout order in this struct should probably be:

const char *name;
unsigned short namelen;
mode_t mode;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/