From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Howells Subject: Re: [PATCH] PROC: Make proc_dir_entry::name a terminal array rather than a pointer Date: Tue, 07 Jun 2011 10:03:49 +0100 Message-ID: <9444.1307437429@redhat.com> References: <20110607055025.GA14145@p183.telecom.by> <20110606154139.20333.57818.stgit@warthog.procyon.org.uk> Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org To: Alexey Dobriyan Return-path: Received: from mx1.redhat.com ([209.132.183.28]:32362 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752497Ab1FGJDy (ORCPT ); Tue, 7 Jun 2011 05:03:54 -0400 In-Reply-To: <20110607055025.GA14145@p183.telecom.by> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Alexey Dobriyan wrote: > Might as well move "namelen" next to the end. Good point. Before: (gdb) p &(((struct proc_dir_entry*)0)->name) $1 = (char (*)[]) 0xc0 After: (gdb) p &(((struct proc_dir_entry*)0)->name) $2 = (char (*)[]) 0xbc The size is 192 in either case; the name just overlaps the hole at the end of the structure. Also, whilst I'm at it: (1) pde_unload_lock can be put two places later, so that if it's just a 32-bit word, there won't be a hole left in the struct on a 64-bit machine. (2) namelen doesn't need to be a 32-bit word, but can be an 8-bit value as it doesn't have to exceed NAME_MAX. David