Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1461734

Re: [PATCH] UBIFS: fix assertion in layout_in_gaps()

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Richard Weinberger <richard.weinberger@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] UBIFS: fix assertion in layout_in_gaps()
Date Sun, 14 Aug 2016 11:10:02 +0200
Message-ID <s5ZAC-5TR-9@gated-at.bofh.it> (permalink)
References <s5kH7-2ca-5@gated-at.bofh.it>
X-Original-To Vincent Stehlé <vincent.stehle@intel.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=+yBio+G5boEWrpDLj3AfSH2567xVbg2GzXdaa+jkJgw=; b=anR2BYFN4VVc4tGKR5lKB0HCcyowqifTlWDPD1bSKMFmo2NSMX8wH7BJ/QRJa72GYT 79H+8cJQ90txrPorMXAaJbINpACL2io6p0P2NHBUKq13kWh9sz5RvH4Md1m3e/wVPpyP 3+MjYhZCegrv5KTHdI1+CcfL6kFrzFcXo24INi299XHAVJzKsVbR4snzmvGFIihY63Oz b11ZA3Bw0AZfZdU7FSEIKBr+cemvQLuPuJzJ2rIk/GcqgNo3BIj9MzKhOyNgh1H/vCpM gkqRemfqx7muRwfwcpbyvuzLTNLC2C9mxuKRMg9l4K7RyMV0givityDr+ukpv4i+sayS yy9A==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=+yBio+G5boEWrpDLj3AfSH2567xVbg2GzXdaa+jkJgw=; b=EODMOLCclQjM4T84kWqYQM3OXOWxK9L1YUEcGQCiMR4ykozyxp0B6qXvV+KKmaycDK BLCk5EO/lgpRGC0dH8oldeajEigm0ssVvV9LSI3EaNdE5BAzBF2BHgLX7BlJgL4co8W0 g0DZ4mlHcmnT/UJFrLhDlPLuHligexhsGuttUUUbtO9xKLukcfjp3f42q1fohj3XjzJk D1AReVz9pGGm2fevqXfwXar1uOLCSU+/thXg51TnmIAZgukh9ZJsnE5tDE36J8W6CJnG DVmCRgtIbo0v4jF27PMmu4lBxcTfSs4EZ0aFY3Lstf1HAc14oe1MKSvysftOoK8yaErY giBQ==
X-Gm-Message-State AEkoouu0NNyFaqZOXynrWeDN5HlUn6fs/ixyvRxpG7vL9hfU3prnE/ntwMLMbTdVyOAqzvyEgBJyOfJupdRB7w==
X-Received by 10.157.40.122 with SMTP id h55mr9894494otd.91.1471165233906; Sun, 14 Aug 2016 02:00:33 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8BIT
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 35
Organization linux.* mail to news gateway
X-Original-Cc "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>, LKML <linux-kernel@vger.kernel.org>, Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
X-Original-Date Sun, 14 Aug 2016 11:00:33 +0200
X-Original-Message-ID <CAFLxGvwqvLpUUzqc_5=iTB03NdU_mYvrmPqRjTZ6O-x+mzTTeA@mail.gmail.com>
X-Original-References <1471008390-19227-1-git-send-email-vincent.stehle@intel.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1461734

Show key headers only | View raw


Vincent,

On Fri, Aug 12, 2016 at 3:26 PM, Vincent Stehlé
<vincent.stehle@intel.com> wrote:
> An assertion in layout_in_gaps() verifies that the gap_lebs pointer is
> below the maximum bound. When computing this maximum bound the idx_lebs
> count is multiplied by sizeof(int), while C pointers arithmetic does take
> into account the size of the pointed elements implicitly already. Remove
> the multiplication to fix the assertion.
>
> Fixes: 1e51764a3c2ac05a ("UBIFS: add new flash file system")
> Signed-off-by: Vincent Stehlé <vincent.stehle@intel.com>
> Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
> ---
>  fs/ubifs/tnc_commit.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c
> index b45345d..51157da 100644
> --- a/fs/ubifs/tnc_commit.c
> +++ b/fs/ubifs/tnc_commit.c
> @@ -370,7 +370,7 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt)
>
>         p = c->gap_lebs;
>         do {
> -               ubifs_assert(p < c->gap_lebs + sizeof(int) * c->lst.idx_lebs);
> +               ubifs_assert(p < c->gap_lebs + c->lst.idx_lebs);

Good catch! Did you hit this assertion or was it found by review?
I bet the latter since it is here since ever and given the wrongness
it is unlikely to trigger.

-- 
Thanks,
//richard

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] UBIFS: fix assertion in layout_in_gaps() Vincent Stehlé <vincent.stehle@intel.com> - 2016-08-12 15:30 +0200
  Re: [PATCH] UBIFS: fix assertion in layout_in_gaps() Artem Bityutskiy <artem.bityutskiy@linux.intel.com> - 2016-08-12 17:50 +0200
  Re: [PATCH] UBIFS: fix assertion in layout_in_gaps() Richard Weinberger <richard.weinberger@gmail.com> - 2016-08-14 11:10 +0200
    Re: [PATCH] UBIFS: fix assertion in layout_in_gaps() Vincent Stehlé <vincent.stehle@intel.com> - 2016-08-16 09:40 +0200

csiph-web