All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Andrey Ryabinin <a.ryabinin@samsung.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Tejun Heo <tj@kernel.org>, <linux-kernel@vger.kernel.org>,
	<tetra2005@gmail.com>, <preobr@google.com>, <dvyukov@google.com>,
	<kcc@google.com>, <koct9i@gmail.com>
Subject: Re: [PATCH] lib: idr: fix out-of-bounds pointer dereference
Date: Tue, 24 Jun 2014 15:48:32 +0800	[thread overview]
Message-ID: <53A92D50.3050507@cn.fujitsu.com> (raw)
In-Reply-To: <53A91125.8020203@samsung.com>


326cf0f0f308 ("idr: fix top layer handling") enlarged the pa array.
But the additional "+1" space is only used in id-allocation, it is free
in other usage, (paa may point to the additional "+1" space, but not dereference it).
so you can reuse it.

In the 3 functions your patch touched:
-	struct idr_layer ***paa = &pa[0];
+	struct idr_layer ***paa = &pa[1];


I don't reject your patch, I had review it.

Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>

The reason why I'm still muttering here is that I wish a simple solution
to fix the problem. And:
1) your patch also makes use of the additional "+1" @pa space: *++paa = p
2) your patch may slight enlarge the function body.
3) I think you patch reduces the readability a little although the idr code
   itself is already shit.

  reply	other threads:[~2014-06-24  7:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-23 13:37 [PATCH] lib: idr: fix out-of-bounds pointer dereference Andrey Ryabinin
2014-06-24  1:26 ` Lai Jiangshan
2014-06-24  5:48   ` Andrey Ryabinin
2014-06-24  7:48     ` Lai Jiangshan [this message]
2014-06-24  8:17       ` Andrey Ryabinin

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=53A92D50.3050507@cn.fujitsu.com \
    --to=laijs@cn.fujitsu.com \
    --cc=a.ryabinin@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=dvyukov@google.com \
    --cc=kcc@google.com \
    --cc=koct9i@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=preobr@google.com \
    --cc=tetra2005@gmail.com \
    --cc=tj@kernel.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.