From: matt mooney <mfm@muteddisk.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: "André Goddard Rosa" <andre.goddard@gmail.com>,
linux-kernel@vger.kernel.org,
"Alan Jenkins" <alan-jenkins@tuffmail.co.uk>,
"Tim Abbott" <tabbott@ksplice.com>
Subject: Re: [PATCH v4 2/2] bsearch: prevent overflow when computing middle comparison element
Date: Thu, 23 Sep 2010 22:50:12 -0700 [thread overview]
Message-ID: <20100924055012.GC18432@haskell.muteddisk.com> (raw)
In-Reply-To: <201009231056.11938.rusty@rustcorp.com.au>
On 10:56 Thu 23 Sep , Rusty Russell wrote:
> On Thu, 23 Sep 2010 12:12:13 am André Goddard Rosa wrote:
> > On Fri, Nov 13, 2009 at 8:42 PM, Rusty Russell <rusty@rustcorp.com.au> wrote:
> > > On Sat, 14 Nov 2009 01:33:04 am Thiago Farina wrote:
> > >> Hi Rusty,
> > >>
> > >> On Thu, Nov 12, 2009 at 11:06 AM, Rusty Russell <rusty@rustcorp.com.au> wrote:
> > >> > On Wed, 11 Nov 2009 01:30:25 am André Goddard Rosa wrote:
> > >> >> It's really difficult to occur in practice because the sum of the lower
> > >> >> and higher limits must overflow an int variable, but it can occur when
> > >> >> working with large arrays. We'd better safe than sorry by avoiding this
> > >> >> overflow situation when computing the middle element for comparison.
> > >> >
> > >> > I applied all these, after testing. In future would have been nice for you
> > >> > to have posted a test patch so I didn't have make my own...
> > >>
> > >> Where did you apply this patch?
> > >
> > > To my kernel series, which means it is now in linux-next.
> > >
> > > Hope that helps,
> > > Rusty.
> > >
> >
> > Hi, Rusty!
> >
> > Is there any chance that this patchset will land into mainline anytime soon?
> >
> > Here we have another use for the binary search function:
> > http://marc.info/?l=linux-kernel&m=128515012817787&w=2
>
> "Unused code is buggy code". Can we have some users please? Do people
> care that uninlining means an indirect fn call now for cmp?
>
> Nonetheless, I've merged all the fixes together:
>
[snip]
> +#include <linux/module.h>
> +#include <linux/bsearch.h>
> +
> +/*
> + * bsearch - binary search an array of elements
> + * @key: pointer to item being searched for
> + * @base: pointer to data to sort
The comment for "@base" seems wrong. It appears that it should say "pointer to
sorted data" or "pointer to search data" instead.
-mfm
next prev parent reply other threads:[~2010-09-24 5:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1257864802.git.andre.goddard@gmail.com>
2009-11-10 15:00 ` [PATCH v4 1/2] bsearch: avoid unneeded decrement arithmetic André Goddard Rosa
2009-11-10 15:00 ` [PATCH v4 2/2] bsearch: prevent overflow when computing middle comparison element André Goddard Rosa
2009-11-11 15:09 ` Thiago Farina
2009-11-11 15:28 ` Thiago Farina
2009-11-12 13:06 ` Rusty Russell
2009-11-12 13:23 ` André Goddard Rosa
2009-11-13 15:03 ` Thiago Farina
2009-11-13 23:42 ` Rusty Russell
[not found] ` <AANLkTinhg-ZgQRQ5KUXR-FeTa9zo+cUF+3vZykzeaHwE@mail.gmail.com>
2010-09-23 1:26 ` Rusty Russell
2010-09-24 5:50 ` matt mooney [this message]
2010-10-04 23:32 ` Rusty Russell
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=20100924055012.GC18432@haskell.muteddisk.com \
--to=mfm@muteddisk.com \
--cc=alan-jenkins@tuffmail.co.uk \
--cc=andre.goddard@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=tabbott@ksplice.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox