lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090105100318.GC7645@localhost>
Date:	Mon, 5 Jan 2009 13:03:18 +0300
From:	Cyrill Gorcunov <gorcunov@...il.com>
To:	Pekka Enberg <penberg@...helsinki.fi>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Nick Piggin <npiggin@...e.de>, Rik van Riel <riel@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Jiri Slaby <jirislaby@...il.com>
Subject: Re: [PATCH] mm: __nr_to_section - make it safe against overflow

[Pekka Enberg - Mon, Jan 05, 2009 at 12:00:58PM +0200]
| Hi Cyrill,
| 
| On Mon, Jan 5, 2009 at 11:40 AM, Cyrill Gorcunov <gorcunov@...il.com> wrote:
| > @@ -980,9 +986,12 @@ extern struct mem_section mem_section[NR
| >
| >  static inline struct mem_section *__nr_to_section(unsigned long nr)
| >  {
| > -       if (!mem_section[SECTION_NR_TO_ROOT(nr)])
| > +       unsigned long idx = SECTION_NR_TO_ROOT(nr);
| > +       WARN_ON_ONCE(idx >= NR_SECTION_ROOTS);
| > +
| > +       if (idx >=NR_SECTION_ROOTS || !mem_section[idx])
| >                return NULL;
| 
| Looks good to me but I have minor nitpick. You might want to write the
| above like this:
| 
|     if (WARN_ON_ONCE(idx >= NR_SECTION_ROOTS))
|             return NULL;
| 
| to separate the error condition from the normal case where we don't
| have a mem section.
| 
| > -       return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK];
| > +       return &mem_section[idx][nr & SECTION_ROOT_MASK];
| >  }
| 

Hi Pekka,

thanks, indeed! I forget that WARN_.. do return a value :)
Will fix shortly.

		- Cyrill -
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ