All of lore.kernel.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: linux-mtd@lists.infradead.org, adrian.hunter@intel.com
Subject: Re: question about fs/ubifs/orphan.c
Date: Sun, 08 Jul 2012 15:40:13 +0300	[thread overview]
Message-ID: <1341751213.2104.7.camel@koala> (raw)
In-Reply-To: <alpine.DEB.2.02.1207081119490.2436@localhost6.localdomain6>

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

On Sun, 2012-07-08 at 11:21 +0200, Julia Lawall wrote:
> The function ubifs_orphan_start_commit contains the code:
> 
>          list_for_each_entry(orphan, &c->orph_new, new_list) {
>                  ubifs_assert(orphan->new);
>                  orphan->new = 0;
>                  *last = orphan;
>                  last = &orphan->cnext;
>          }
>          *last = orphan->cnext;
> 
> After list_for_each_entry, orphan is just an address at an offset from the 
> list head, not a pointer to a real structure.  So it does not seem correct 
> to access its cnext field.

Looks like you've spotted a but - we write some irrelevant address to an
area within the 'struct ubifs_info'.

I think what the code meant to do is to write NULL there:

- *last = orphan->cnext;
+ *last = NULL;

I wonder if this could be a reason for some of strange bugs we have seen
reports for.

Well-spotted Julia, thanks! How did you do this - writing another cocci
script for the kernel?

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2012-07-08 12:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-08  9:21 question about fs/ubifs/orphan.c Julia Lawall
2012-07-08  9:22 ` Julia Lawall
2012-07-09  6:46   ` Adrian Hunter
2012-07-09  7:21     ` Julia Lawall
2012-07-08 12:40 ` Artem Bityutskiy [this message]
2012-07-08 13:06   ` Julia Lawall
2012-07-09  6:47   ` Adrian Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341751213.2104.7.camel@koala \
    --to=dedekind1@gmail.com \
    --cc=adrian.hunter@intel.com \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.