z3fold: don't fail kernel build if z3fold_header is too big
PATCH 1/1 z3fold: don't fail kernel build if z3fold_header is too big
Currently the whole kernel build will be stopped if the size of struct z3fold_header is greater than the size of one chunk, which is 64 bytes by default. This may stand in the way of automated test/debug builds so let's remove that and fail the z3fold initialization in such case instead.
--- mm/z3fold.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
mm/z3fold.c +8 -3
@@ -866,10 +866,15 @@ MODULE_ALIAS("zpool-z3fold");static int __init init_z3fold (void ) { -/* Make sure the z3fold header will fit in one chunk */ -BUILD_BUG_ON (sizeof (struct z3fold_header ) >ZHDR_SIZE_ALIGNED ); -zpool_register_driver (&z3fold_zpool_driver); +/* Fail the initialization if z3fold header won't fit in one chunk */ +if (sizeof (struct z3fold_header ) >ZHDR_SIZE_ALIGNED ) { +pr_err ("z3fold: z3fold_header size (%d) is bigger than " +"the chunk size (%d), can't proceed\n" , +sizeof (struct z3fold_header ) ,ZHDR_SIZE_ALIGNED ); +return -E2BIG ; + } +zpool_register_driver (&z3fold_zpool_driver);return 0 ; }
Signature · 7 lines
2.4.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
kbuild test robot
build botreproduce:
Hi Vitaly,
[auto build test WARNING on mmotm/master]
[also build test WARNING on v4.9-rc4 next-20161110]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Vitaly-Wool/z3fold-don-t-fail-kernel-build-if-z3fold_header-is-too-big/20161110-161657 base: git://git.cmpxchg.org/linux-mmotm.git master config: x86_64-randconfig-x014-201645 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:6:0,
from include/linux/kernel.h:13,
from include/linux/list.h:8,
from mm/z3fold.c:26:
mm/z3fold.c: In function 'init_z3fold':
include/linux/kern_levels.h:4:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long unsigned int' [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
#define KERN_ERR KERN_SOH "3" /* error conditions */
^~~~~~~~
include/linux/printk.h:277:9: note: in expansion of macro 'KERN_ERR'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~
>> mm/z3fold.c:817:3: note: in expansion of macro 'pr_err' pr_err("z3fold: z3fold_header size (%d) is bigger than " ^~~~~~
vim +/pr_err +817 mm/z3fold.c
801 .create = z3fold_zpool_create,
802 .destroy = z3fold_zpool_destroy,
803 .malloc = z3fold_zpool_malloc,
804 .free = z3fold_zpool_free,
805 .shrink = z3fold_zpool_shrink,
806 .map = z3fold_zpool_map,
807 .unmap = z3fold_zpool_unmap,
808 .total_size = z3fold_zpool_total_size,
809 };
810
811 MODULE_ALIAS("zpool-z3fold");
812
813 static int __init init_z3fold(void)
814 {
815 /* Fail the initialization if z3fold header won't fit in one chunk */
816 if (sizeof(struct z3fold_header) > ZHDR_SIZE_ALIGNED) {
> 817 pr_err("z3fold: z3fold_header size (%d) is bigger than " 818 "the chunk size (%d), can't proceed\n",
819 sizeof(struct z3fold_header) , ZHDR_SIZE_ALIGNED);
820 return -E2BIG;
821 }
822
823 zpool_register_driver(&z3fold_zpool_driver);
824 return 0;
825 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botreproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…
Hi Vitaly,
[auto build test WARNING on mmotm/master]
[also build test WARNING on v4.9-rc4 next-20161110]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Vitaly-Wool/z3fold-don-t-fail-kernel-build-if-z3fold_header-is-too-big/20161110-161657 base: git://git.cmpxchg.org/linux-mmotm.git master config: tile-allmodconfig (attached as .config) compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile
All warnings (new ones prefixed by >>):
mm/z3fold.c: In function 'init_z3fold':
>> mm/z3fold.c:817:3: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long unsigned int' [-Wformat]
vim +817 mm/z3fold.c
801 .create = z3fold_zpool_create,
802 .destroy = z3fold_zpool_destroy,
803 .malloc = z3fold_zpool_malloc,
804 .free = z3fold_zpool_free,
805 .shrink = z3fold_zpool_shrink,
806 .map = z3fold_zpool_map,
807 .unmap = z3fold_zpool_unmap,
808 .total_size = z3fold_zpool_total_size,
809 };
810
811 MODULE_ALIAS("zpool-z3fold");
812
813 static int __init init_z3fold(void)
814 {
815 /* Fail the initialization if z3fold header won't fit in one chunk */
816 if (sizeof(struct z3fold_header) > ZHDR_SIZE_ALIGNED) {
> 817 pr_err("z3fold: z3fold_header size (%d) is bigger than " 818 "the chunk size (%d), can't proceed\n",
819 sizeof(struct z3fold_header) , ZHDR_SIZE_ALIGNED);
820 return -E2BIG;
821 }
822
823 zpool_register_driver(&z3fold_zpool_driver);
824 return 0;
825 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation