Re: [PATCH] Avoid potential NULL deref in scripts/genksyms/lex.l

2007-06-24 Thread Jesper Juhl
On 25/06/07, Andrew Morton <[EMAIL PROTECTED]> wrote: On Mon, 25 Jun 2007 00:02:03 +0200 "Jesper Juhl" <[EMAIL PROTECTED]> wrote: > > > + if (!file || !e) > > > + exit(1); > > >*e = '\0'; > > >cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1); > > >cur_lin

Re: [PATCH] Avoid potential NULL deref in scripts/genksyms/lex.l

2007-06-24 Thread Andrew Morton
On Mon, 25 Jun 2007 00:02:03 +0200 "Jesper Juhl" <[EMAIL PROTECTED]> wrote: > > > + if (!file || !e) > > > + exit(1); > > >*e = '\0'; > > >cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1); > > >cur_line = atoi(yytext+2); > > > > I don't think the bug which

Re: [PATCH] Avoid potential NULL deref in scripts/genksyms/lex.l

2007-06-24 Thread Jesper Juhl
On 24/06/07, Andrew Morton <[EMAIL PROTECTED]> wrote: On Sun, 24 Jun 2007 23:40:03 +0200 Jesper Juhl <[EMAIL PROTECTED]> wrote: > strchr() returns NULL in case the string is not found and if that > happens we risk dereferencing a NULL pointer. It never hurts to > check for that condition and exi

Re: [PATCH] Avoid potential NULL deref in scripts/genksyms/lex.l

2007-06-24 Thread Andrew Morton
On Sun, 24 Jun 2007 23:40:03 +0200 Jesper Juhl <[EMAIL PROTECTED]> wrote: > strchr() returns NULL in case the string is not found and if that > happens we risk dereferencing a NULL pointer. It never hurts to > check for that condition and exit normally with an error rather > than crashing. > >

[PATCH] Avoid potential NULL deref in scripts/genksyms/lex.l

2007-06-24 Thread Jesper Juhl
strchr() returns NULL in case the string is not found and if that happens we risk dereferencing a NULL pointer. It never hurts to check for that condition and exit normally with an error rather than crashing. (no, the indentation is not according to CodingStyle, it's simply following whatever