mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: thockin@sun.com
Cc: Linus Torvalds <torvalds@transmeta.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [BK PATCH 1/4] remove NGROUPS hard limit (resend)
Date: 05 Nov 2002 20:47:13 +0000	[thread overview]
Message-ID: <1036529233.6757.37.camel@irongate.swansea.linux.org.uk> (raw)
In-Reply-To: <200211052002.gA5K25705723@scl2.sfbay.sun.com>

> +void
> +qsort(void *a, size_t n, size_t es, cmp_t *cmp)
> +{
> +	char *pa, *pb, *pc, *pd, *pl, *pm, *pn;

A recursive algorithm fed user controlled input that dictates how much
it recurses, in a kernel with a stack limit. Oh and since qsort is
O(N^2) worst case and the user controls the input thats another concern.

> +	if ((r = pb - pa) > es)
> +		qsort(a, r / es, es, cmp);
> +	if ((r = pd - pc) > es) {
> +		/* Iterate rather than recurse to save stack space */


I find it hard to believe that a simple bucket sort wouldnt perform as
well in real life and with a defined time/space, or even something like
shell metzner if you want trivial with good typical behaviour.

Alternatively you could just do a merge pass when a new set of groups is
added.


      reply	other threads:[~2002-11-05 20:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-05 20:02 Timothy Hockin
2002-11-05 20:47 ` Alan Cox [this message]

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=1036529233.6757.37.camel@irongate.swansea.linux.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thockin@sun.com \
    --cc=torvalds@transmeta.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

all inboxes | Powered by JetHome®