From patchwork Mon Mar 30 21:01:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Ehrenberg X-Patchwork-Id: 456317 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 912A91400D5 for ; Tue, 31 Mar 2015 08:03:43 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=google.com header.i=@google.com header.b=JZDQ0FTe; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YcgpF-0005ka-Bh; Mon, 30 Mar 2015 21:02:25 +0000 Received: from mail-ig0-x22f.google.com ([2607:f8b0:4001:c05::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ycgoy-0005Zx-3Z for linux-mtd@lists.infradead.org; Mon, 30 Mar 2015 21:02:08 +0000 Received: by igbqf9 with SMTP id qf9so656289igb.1 for ; Mon, 30 Mar 2015 14:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=GkDQG20AMT0185zPKCMA1LkNAB8cEgiVFaeh38r69xY=; b=JZDQ0FTeUyMASy2sOV0EdPHcx/3QczCpIXVFyvkzZ5/XCjcE9yUAzWLhkM0iRmkvjQ pfEVvLGVFF3PbuHYjtBkKgbcSWKNNXFCbx82V+ldGEGc2mONK6hKwglBiBjzTr9UAmKi UjyrhF25FZq3t635HB+9/c5s7CSyYkYA4QZxxxACsGdhqt3t8On47SyEh2bqNOWJQlBG QHH3bQQ7Bloq/SgrFOg6I79LUXhd7r6q+hVjqLlqKtcR5d6mJAzuG+kxGJ9qNPlt3FcN kuoE0MGmzWC2yIWGc+PkRAVE1nIgOiNchuqkhP6cM0mbCuBuaL1msKGdUfZFrglenjMC e8iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=GkDQG20AMT0185zPKCMA1LkNAB8cEgiVFaeh38r69xY=; b=Qac/cqc6+u7RtpCqUUnzYccX7TOJvpcb++UemrD3tsxagmBnORrLT80YF74hwpsSGQ PP6fYiQuJYQ2jWNP1Jb4iFmp6bIBCoUazQ1LlAByU+QY7lUfBDff7zXbP6YiIfTeeigO 892AKlPru6u90Koa6pPZMuJ/mVGdzsKOnx/5QCXBdTCzc+LNjXlA2ZCW1f4Ibg8m5s1z X+L/27EoLQt8iVse4mkbyWjlJg6w5My5/2uqf8tHzZ4L/NllUe2o3KFHqsN0K4zFh0f0 IvUX5HHiym9vWdW+jcrEzdY66MN7dbw43fpnicBDacfqCzfl4Aq6gu4yVNZwREqWlI0/ Sxrw== X-Gm-Message-State: ALoCoQkjjFUkhUAm3hmoELP9F32hhGwGN4bD6QR7DuVljmmQULkVSVZW2M3gxM/0g1FGqQ8xCgu/ X-Received: by 10.43.82.137 with SMTP id ac9mr6917289icc.37.1427749306454; Mon, 30 Mar 2015 14:01:46 -0700 (PDT) Received: from dehrenberg.mtv.corp.google.com ([172.22.65.87]) by mx.google.com with ESMTPSA id x10sm8306550igl.13.2015.03.30.14.01.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Mar 2015 14:01:45 -0700 (PDT) From: Dan Ehrenberg To: computersforpeace@gmail.com, linux-mtd@lists.infradead.org, ezequiel@vanguardiasur.com.ar, Richard Weinberger Subject: [PATCH v4 3/3] mtd: part: Remove partition overlap checks Date: Mon, 30 Mar 2015 14:01:38 -0700 Message-Id: <1427749298-31714-4-git-send-email-dehrenberg@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1427749298-31714-1-git-send-email-dehrenberg@chromium.org> References: <1427749298-31714-1-git-send-email-dehrenberg@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150330_140208_256531_9B450881 X-CRM114-Status: GOOD ( 10.37 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:4001:c05:0:0:0:22f listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Cc: gwendal@chromium.org, Dan Ehrenberg X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch makes MTD dynamic partitioning more flexible by removing overlap checks for dynamic partitions. I don't see any particular reason why overlapping dynamic partitions should be prohibited while static partitions are allowed to overlap freely. The checks previously had an off-by-one error, where 'end' should be one less than what it is currently set at, and adding partitions out of increasing order will fail. Disabling the checks resolves this issue. Signed-off-by: Dan Ehrenberg --- drivers/mtd/mtdpart.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index be80340..c444842 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -582,7 +582,7 @@ int mtd_add_partition(struct mtd_info *master, const char *name, long long offset, long long length) { struct mtd_partition part; - struct mtd_part *p, *new; + struct mtd_part *new; uint64_t start, end; int ret = 0; @@ -611,17 +611,6 @@ int mtd_add_partition(struct mtd_info *master, const char *name, end = offset + length; mutex_lock(&mtd_partitions_mutex); - list_for_each_entry(p, &mtd_partitions, list) - if (p->master == master) { - if ((start >= p->offset) && - (start < (p->offset + p->mtd.size))) - goto err_inv; - - if ((end >= p->offset) && - (end < (p->offset + p->mtd.size))) - goto err_inv; - } - list_add(&new->list, &mtd_partitions); mutex_unlock(&mtd_partitions_mutex); @@ -630,10 +619,6 @@ int mtd_add_partition(struct mtd_info *master, const char *name, mtd_add_partition_attrs(new); return ret; -err_inv: - mutex_unlock(&mtd_partitions_mutex); - free_partition(new); - return -EINVAL; } EXPORT_SYMBOL_GPL(mtd_add_partition);