At Mon, 02 Dec 2002 11:39:34 +0100 (MET),
Clemens Ladisch wrote:
>
> Jaroslav Kysela wrote:
> > revision 1.6
> > date: 2002/11/28 13:54:34; author: perex; state: Exp; lines: +3 -4
> >
> > Fixed parsiong of id where dst is NULL
> >
> > Index: initval.h
> > ===================================================================
> > RCS file: /cvsroot/alsa/alsa-kernel/include/initval.h,v
> > retrieving revision 1.5
> > retrieving revision 1.6
> > diff -u -r1.5 -r1.6
> > --- initval.h 23 Nov 2002 10:41:53 -0000 1.5
> > +++ initval.h 28 Nov 2002 13:54:34 -0000 1.6
> > @@ -156,10 +156,9 @@
> > for (s = *str; isalpha(*s) || isdigit(*s) || *s == '_'; s++);
> > if (s != *str) {
> > *dst = (char *)kmalloc(s - *str, GFP_KERNEL);
> > - if ((d = *dst) != NULL) {
> > - s = *str;
> > - while (isalpha(*s) || isdigit(*s) || *s == '_')
> > + s = *str; d = *dst;
> > + while (isalpha(*s) || isdigit(*s) || *s == '_')
> > + if (d != NULL)
> > *d++ = *s++;
> > - }
> > }
> > *str = s;
>
> I'm not sure I understand what this patch tries to fix. Revision 1.5 seems
> to work when kmalloc fails (it skips the input field and returns NULL),
> but revision 1.6 goes into an infinite loop because s isn't incremented
> when d == NULL.i guess s should be proceeded even if kmalloc fails, i.e. skip the word. > > And IMNSHO the returned string should be zero-terminated. yep. Takashi
initval-fix.dif
Description: Binary data
