Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753482AbcKOQAi (ORCPT ); Tue, 15 Nov 2016 11:00:38 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34895 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751701AbcKOQAg (ORCPT ); Tue, 15 Nov 2016 11:00:36 -0500 Date: Tue, 15 Nov 2016 17:00:30 +0100 From: Vitaly Wool To: Linux-MM , linux-kernel@vger.kernel.org Cc: Dan Streetman , Andrew Morton Subject: [PATCH 2/3] z3fold: don't fail kernel build if z3fold_header is too big Message-Id: <20161115170030.f0396011fa00423ff711a3b4@gmail.com> In-Reply-To: <20161115165538.878698352bd45e212751b57a@gmail.com> References: <20161115165538.878698352bd45e212751b57a@gmail.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1186 Lines: 36 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 just fail the z3fold initialization in such case instead. Signed-off-by: Vitaly Wool --- mm/z3fold.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mm/z3fold.c b/mm/z3fold.c index 7ad70fa..ffd9353 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -870,10 +870,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