linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] z3fold: don't fail kernel build if z3fold_header is too big
@ 2016-11-10  7:54 Vitaly Wool
  2016-11-10  9:04 ` kbuild test robot
  2016-11-10  9:05 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Vitaly Wool @ 2016-11-10  7:54 UTC (permalink / raw)
  To: Linux-MM, linux-kernel; +Cc: Dan Streetman, Andrew Morton

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.

Signed-off-by: Vitaly Wool <vitalywool@gmail.com>
---
 mm/z3fold.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/mm/z3fold.c b/mm/z3fold.c
index cd3713d..5fe2652 100644
--- a/mm/z3fold.c
+++ b/mm/z3fold.c
@@ -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;
 }
 
-- 
2.4.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] z3fold: don't fail kernel build if z3fold_header is too big
  2016-11-10  7:54 [PATCH] z3fold: don't fail kernel build if z3fold_header is too big Vitaly Wool
@ 2016-11-10  9:04 ` kbuild test robot
  2016-11-10  9:05 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2016-11-10  9:04 UTC (permalink / raw)
  To: Vitaly Wool
  Cc: kbuild-all, Linux-MM, linux-kernel, Dan Streetman, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 2604 bytes --]

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30147 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] z3fold: don't fail kernel build if z3fold_header is too big
  2016-11-10  7:54 [PATCH] z3fold: don't fail kernel build if z3fold_header is too big Vitaly Wool
  2016-11-10  9:04 ` kbuild test robot
@ 2016-11-10  9:05 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2016-11-10  9:05 UTC (permalink / raw)
  To: Vitaly Wool
  Cc: kbuild-all, Linux-MM, linux-kernel, Dan Streetman, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 1998 bytes --]

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 46697 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-10  9:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-10  7:54 [PATCH] z3fold: don't fail kernel build if z3fold_header is too big Vitaly Wool
2016-11-10  9:04 ` kbuild test robot
2016-11-10  9:05 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox