[lkml]   [2002]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [BK PATCH 1/4] remove NGROUPS hard limit (resend)
    > +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

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:30    [W:0.039 / U:4.900 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site