Messages in this thread | | | Subject | Re: [BK PATCH 1/4] remove NGROUPS hard limit (resend) | From | Alan Cox <> | Date | 05 Nov 2002 20:47:13 +0000 |
| |
> +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.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |