Message ID | 172298840561.6062.13050352142637689126@noble.neil.brown.name (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | SQUASH nfsd: don't allocate the versions array | expand |
On Wed, 2024-08-07 at 09:53 +1000, NeilBrown wrote: > > In "nfsd: don't allocate the versions array" I made the various arrays > of version information fixed-sized - except nfsd_version. > The size of nfsd_version was determined by CONFIG settings and could be > smaller than the index used by nfsd_support_version(). > > This patch makes it fixed-size. It should be squashed into the original. > > Signed-off-by: NeilBrown <neilb@suse.de> > --- > fs/nfsd/nfssvc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c > index 1cef09a3c78e..defc430f912f 100644 > --- a/fs/nfsd/nfssvc.c > +++ b/fs/nfsd/nfssvc.c > @@ -106,7 +106,7 @@ static struct svc_program nfsd_acl_program = { > > #endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */ > > -static const struct svc_version *nfsd_version[] = { > +static const struct svc_version *nfsd_version[NFSD_MAXVERS+1] = { > #if defined(CONFIG_NFSD_V2) > [2] = &nfsd_version2, > #endif Reviewed-by: Jeff Layton <jlayton@kernel.org>
Hi NeilBrown, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [also build test ERROR on v6.11-rc2] [cannot apply to next-20240808] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/NeilBrown/SQUASH-nfsd-don-t-allocate-the-versions-array/20240807-075516 base: linus/master patch link: https://lore.kernel.org/r/172298840561.6062.13050352142637689126%40noble.neil.brown.name patch subject: [PATCH] SQUASH nfsd: don't allocate the versions array config: x86_64-rhel-8.3 (https://download.01.org/0day-ci/archive/20240809/202408090618.Emrg9UsT-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240809/202408090618.Emrg9UsT-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202408090618.Emrg9UsT-lkp@intel.com/ All error/warnings (new ones prefixed by >>): >> fs/nfsd/nfssvc.c:109:47: error: 'NFSD_MAXVERS' undeclared here (not in a function); did you mean 'NFS4_MAX_OPS'? 109 | static const struct svc_version *nfsd_version[NFSD_MAXVERS+1] = { | ^~~~~~~~~~~~ | NFS4_MAX_OPS In file included from include/linux/container_of.h:5, from include/linux/list.h:5, from include/linux/rculist.h:10, from include/linux/sched/signal.h:5, from fs/nfsd/nfssvc.c:10: include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ^~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~~~~~~~~~~~ fs/nfsd/nfssvc.c:120:33: note: in expansion of macro 'ARRAY_SIZE' 120 | #define NFSD_NRVERS ARRAY_SIZE(nfsd_version) | ^~~~~~~~~~ fs/nfsd/nfssvc.c:127:35: note: in expansion of macro 'NFSD_NRVERS' 127 | .pg_nvers = NFSD_NRVERS, /* nr of entries in nfsd_version */ | ^~~~~~~~~~~ fs/nfsd/nfssvc.c: In function 'nfsd_support_version': include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ^~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~~~~~~~~~~~ fs/nfsd/nfssvc.c:120:33: note: in expansion of macro 'ARRAY_SIZE' 120 | #define NFSD_NRVERS ARRAY_SIZE(nfsd_version) | ^~~~~~~~~~ fs/nfsd/nfssvc.c:138:44: note: in expansion of macro 'NFSD_NRVERS' 138 | if (vers >= NFSD_MINVERS && vers < NFSD_NRVERS) | ^~~~~~~~~~~ In file included from include/linux/percpu.h:5, from arch/x86/include/asm/msr.h:15, from arch/x86/include/asm/tsc.h:10, from arch/x86/include/asm/timex.h:6, from include/linux/timex.h:67, from include/linux/time32.h:13, from include/linux/time.h:60, from include/linux/jiffies.h:10, from include/linux/ktime.h:25, from include/linux/timer.h:6, from include/linux/workqueue.h:9, from include/linux/srcu.h:21, from include/linux/notifier.h:16, from arch/x86/include/asm/uprobes.h:13, from include/linux/uprobes.h:49, from include/linux/mm_types.h:16, from arch/x86/include/asm/uaccess.h:10, from include/linux/uaccess.h:12, from include/linux/sched/task.h:13, from include/linux/sched/signal.h:9: fs/nfsd/nfssvc.c: In function 'nfsd_alloc_versions': include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/alloc_tag.h:206:16: note: in definition of macro 'alloc_hooks_tag' 206 | typeof(_do_alloc) _res = _do_alloc; \ | ^~~~~~~~~ include/linux/slab.h:728:49: note: in expansion of macro 'alloc_hooks' 728 | #define kmalloc_array(...) alloc_hooks(kmalloc_array_noprof(__VA_ARGS__)) | ^~~~~~~~~~~ fs/nfsd/nfssvc.c:146:22: note: in expansion of macro 'kmalloc_array' 146 | bool *vers = kmalloc_array(NFSD_NRVERS, sizeof(bool), GFP_KERNEL); | ^~~~~~~~~~~~~ include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ^~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~~~~~~~~~~~ fs/nfsd/nfssvc.c:120:33: note: in expansion of macro 'ARRAY_SIZE' 120 | #define NFSD_NRVERS ARRAY_SIZE(nfsd_version) | ^~~~~~~~~~ fs/nfsd/nfssvc.c:146:36: note: in expansion of macro 'NFSD_NRVERS' 146 | bool *vers = kmalloc_array(NFSD_NRVERS, sizeof(bool), GFP_KERNEL); | ^~~~~~~~~~~ include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/alloc_tag.h:206:34: note: in definition of macro 'alloc_hooks_tag' 206 | typeof(_do_alloc) _res = _do_alloc; \ | ^~~~~~~~~ include/linux/slab.h:728:49: note: in expansion of macro 'alloc_hooks' 728 | #define kmalloc_array(...) alloc_hooks(kmalloc_array_noprof(__VA_ARGS__)) | ^~~~~~~~~~~ fs/nfsd/nfssvc.c:146:22: note: in expansion of macro 'kmalloc_array' 146 | bool *vers = kmalloc_array(NFSD_NRVERS, sizeof(bool), GFP_KERNEL); | ^~~~~~~~~~~~~ include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ^~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~~~~~~~~~~~ fs/nfsd/nfssvc.c:120:33: note: in expansion of macro 'ARRAY_SIZE' 120 | #define NFSD_NRVERS ARRAY_SIZE(nfsd_version) | ^~~~~~~~~~ fs/nfsd/nfssvc.c:146:36: note: in expansion of macro 'NFSD_NRVERS' 146 | bool *vers = kmalloc_array(NFSD_NRVERS, sizeof(bool), GFP_KERNEL); | ^~~~~~~~~~~ >> include/linux/alloc_tag.h:212:1: warning: initialization of 'bool *' {aka '_Bool *'} from 'int' makes pointer from integer without a cast [-Wint-conversion] 212 | ({ \ | ^ include/linux/slab.h:728:49: note: in expansion of macro 'alloc_hooks' 728 | #define kmalloc_array(...) alloc_hooks(kmalloc_array_noprof(__VA_ARGS__)) | ^~~~~~~~~~~ fs/nfsd/nfssvc.c:146:22: note: in expansion of macro 'kmalloc_array' 146 | bool *vers = kmalloc_array(NFSD_NRVERS, sizeof(bool), GFP_KERNEL); | ^~~~~~~~~~~~~ include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ^~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~~~~~~~~~~~ fs/nfsd/nfssvc.c:120:33: note: in expansion of macro 'ARRAY_SIZE' 120 | #define NFSD_NRVERS ARRAY_SIZE(nfsd_version) | ^~~~~~~~~~ fs/nfsd/nfssvc.c:151:33: note: in expansion of macro 'NFSD_NRVERS' 151 | for (i = 0; i < NFSD_NRVERS; i++) | ^~~~~~~~~~~ fs/nfsd/nfssvc.c: In function 'nfsd_vers': include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ^~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~~~~~~~~~~~ fs/nfsd/nfssvc.c:120:33: note: in expansion of macro 'ARRAY_SIZE' 120 | #define NFSD_NRVERS ARRAY_SIZE(nfsd_version) | ^~~~~~~~~~ fs/nfsd/nfssvc.c:194:44: note: in expansion of macro 'NFSD_NRVERS' 194 | if (vers < NFSD_MINVERS || vers >= NFSD_NRVERS) | ^~~~~~~~~~~ fs/nfsd/nfssvc.c: In function 'nfsd_reset_versions': include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ^~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~~~~~~~~~~~ fs/nfsd/nfssvc.c:120:33: note: in expansion of macro 'ARRAY_SIZE' 120 | #define NFSD_NRVERS ARRAY_SIZE(nfsd_version) | ^~~~~~~~~~ fs/nfsd/nfssvc.c:571:25: note: in expansion of macro 'NFSD_NRVERS' 571 | for (i = 0; i < NFSD_NRVERS; i++) | ^~~~~~~~~~~ include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ^~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~~~~~~~~~~~ fs/nfsd/nfssvc.c:120:33: note: in expansion of macro 'ARRAY_SIZE' 120 | #define NFSD_NRVERS ARRAY_SIZE(nfsd_version) | ^~~~~~~~~~ fs/nfsd/nfssvc.c:575:25: note: in expansion of macro 'NFSD_NRVERS' 575 | for (i = 0; i < NFSD_NRVERS; i++) | ^~~~~~~~~~~ fs/nfsd/nfssvc.c: In function 'nfsd_init_request': include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ^~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~~~~~~~~~~~ fs/nfsd/nfssvc.c:120:33: note: in expansion of macro 'ARRAY_SIZE' 120 | #define NFSD_NRVERS ARRAY_SIZE(nfsd_version) | ^~~~~~~~~~ fs/nfsd/nfssvc.c:908:32: note: in expansion of macro 'NFSD_NRVERS' 908 | ret->mismatch.lovers = NFSD_NRVERS; | ^~~~~~~~~~~ include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ^~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~~~~~~~~~~~ fs/nfsd/nfssvc.c:120:33: note: in expansion of macro 'ARRAY_SIZE' 120 | #define NFSD_NRVERS ARRAY_SIZE(nfsd_version) | ^~~~~~~~~~ fs/nfsd/nfssvc.c:909:36: note: in expansion of macro 'NFSD_NRVERS' 909 | for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++) { | ^~~~~~~~~~~ include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ^~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~~~~~~~~~~~ fs/nfsd/nfssvc.c:120:33: note: in expansion of macro 'ARRAY_SIZE' 120 | #define NFSD_NRVERS ARRAY_SIZE(nfsd_version) | ^~~~~~~~~~ fs/nfsd/nfssvc.c:915:37: note: in expansion of macro 'NFSD_NRVERS' 915 | if (ret->mismatch.lovers == NFSD_NRVERS) | ^~~~~~~~~~~ include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/compiler.h:243:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ^~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~~~~~~~~~~~ fs/nfsd/nfssvc.c:120:33: note: in expansion of macro 'ARRAY_SIZE' 120 | #define NFSD_NRVERS ARRAY_SIZE(nfsd_version) | ^~~~~~~~~~ fs/nfsd/nfssvc.c:918:18: note: in expansion of macro 'NFSD_NRVERS' 918 | for (i = NFSD_NRVERS - 1; i >= NFSD_MINVERS; i--) { | ^~~~~~~~~~~ fs/nfsd/nfssvc.c: At top level: >> fs/nfsd/nfssvc.c:109:34: warning: 'nfsd_version' defined but not used [-Wunused-variable] 109 | static const struct svc_version *nfsd_version[NFSD_MAXVERS+1] = { | ^~~~~~~~~~~~ vim +109 fs/nfsd/nfssvc.c 108 > 109 static const struct svc_version *nfsd_version[NFSD_MAXVERS+1] = { 110 #if defined(CONFIG_NFSD_V2) 111 [2] = &nfsd_version2, 112 #endif 113 [3] = &nfsd_version3, 114 #if defined(CONFIG_NFSD_V4) 115 [4] = &nfsd_version4, 116 #endif 117 }; 118
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 1cef09a3c78e..defc430f912f 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -106,7 +106,7 @@ static struct svc_program nfsd_acl_program = { #endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */ -static const struct svc_version *nfsd_version[] = { +static const struct svc_version *nfsd_version[NFSD_MAXVERS+1] = { #if defined(CONFIG_NFSD_V2) [2] = &nfsd_version2, #endif
In "nfsd: don't allocate the versions array" I made the various arrays of version information fixed-sized - except nfsd_version. The size of nfsd_version was determined by CONFIG settings and could be smaller than the index used by nfsd_support_version(). This patch makes it fixed-size. It should be squashed into the original. Signed-off-by: NeilBrown <neilb@suse.de> --- fs/nfsd/nfssvc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)