From patchwork Fri Aug 17 14:35:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Genoud X-Patchwork-Id: 1338891 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 2479CDF266 for ; Fri, 17 Aug 2012 14:42:05 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T2Nh6-0002U1-Ai; Fri, 17 Aug 2012 14:38:36 +0000 Received: from mail-wi0-f171.google.com ([209.85.212.171]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T2Ned-0001B6-Ub; Fri, 17 Aug 2012 14:36:09 +0000 Received: by wibhq4 with SMTP id hq4so1306680wib.0 for ; Fri, 17 Aug 2012 07:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=OvomculHZvTtvDwrCgL/DfGia8yzswhMJNkKL1Mp34U=; b=0oFfdbrh3sDdS/aPQ2tDJL05oHjPuH/WnBa5uGUK4ZUDNaT8mZJ6HCe/7/w9hAYqoA 22gZcCZj749BYaigJiGsYbfMMfg4KpMZIdJfhsUbQFh65cwaRsyGqw3sBrxqj6q4ae52 GYRL13lrWa/o8FlbCbIwbVab8qn68lkPPCDciyldADx9Ul0PiFv4cHXCScB35WaJsnW7 R82cHbPspDnyehpAPonXXBoqQQahVJrXWzygoF9XMbJqbCuQcjydWdX3FMFSG7pczt9N jaCqeKvP5KZBWqfGACBoNhozowcLiw96ViLtrFrbb/eNx/KExTmxG1moUZ3ZlMXupDsk 6B9w== Received: by 10.180.100.131 with SMTP id ey3mr5579139wib.15.1345214157418; Fri, 17 Aug 2012 07:35:57 -0700 (PDT) Received: from localhost.localdomain (lyon.paratronic.fr. [213.41.177.106]) by mx.google.com with ESMTPS id dc3sm10053154wib.7.2012.08.17.07.35.56 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 17 Aug 2012 07:35:56 -0700 (PDT) From: Richard Genoud To: Artem Bityutskiy Subject: [PATCH 5/8] UBI: check max_beb_per1024 value in ubi_attach_mtd_dev Date: Fri, 17 Aug 2012 16:35:21 +0200 Message-Id: <1345214124-5478-6-git-send-email-richard.genoud@gmail.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1345214124-5478-1-git-send-email-richard.genoud@gmail.com> References: <1345214124-5478-1-git-send-email-richard.genoud@gmail.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.171 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (richard.genoud[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Richard Genoud , linux-mtd@lists.infradead.org, Shmulik Ladkani , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org max_beb_per1024 shouldn't be negative, and a 0 value will be treated as the default value. Signed-off-by: Richard Genoud --- drivers/mtd/ubi/build.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 58fe53d..ec7311f 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -855,6 +855,16 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, struct ubi_device *ubi; int i, err, ref = 0; + if (max_beb_per1024 < 0) + return -EINVAL; + + /* + * A value of 0 is forced to the default value to keep the same + * behavior between ubiattach command and module parameter + */ + if (!max_beb_per1024) + max_beb_per1024 = CONFIG_MTD_UBI_BEB_LIMIT; + /* * Check if we already have the same MTD device attached. *