• David Howells's avatar
    proc: make struct proc_dir_entry::name a terminal array rather than a pointer · 09570f91
    David Howells authored
    Since __proc_create() appends the name it is given to the end of the PDE
    structure that it allocates, there isn't a need to store a name pointer.
    Instead we can just replace the name pointer with a terminal char array of
    _unspecified_ length.  The compiler will simply append the string to statically
    defined variables of PDE type overlapping any hole at the end of the structure
    and, unlike specifying an explicitly _zero_ length array, won't give a warning
    if you try to statically initialise it with a string of more than zero length.
    
    Also, whilst we're at it:
    
     (1) Move namelen to end just prior to name and reduce it to a single byte
         (name shouldn't be longer than NAME_MAX).
    
     (2) Move pde_unload_lock two places further on so that if it's four bytes in
         size on a 64-bit machine, it won't cause an unused hole in the PDE struct.
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    09570f91
root.c 4.41 KB