Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 25 Oct 2001 09:44:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 25 Oct 2001 09:44:45 -0400 Received: from krynn.axis.se ([193.13.178.10]:57831 "EHLO krynn.axis.se") by vger.kernel.org with ESMTP id convert rfc822-to-8bit; Thu, 25 Oct 2001 09:44:32 -0400 Message-ID: From: Peter Kjellerstedt To: =?iso-8859-1?Q?=27Peter_W=E4chtler=27?= , =?iso-8859-1?Q?Ren=E9_Scharfe?= Cc: Linus Torvalds , Linux Kernel Mailing List Subject: RE: [PATCH] strtok --> strsep in framebuffer drivers (part 2) Date: Thu, 25 Oct 2001 15:44:40 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Peter W?chtler [mailto:pwaechtler@loewe-komp.de] > Sent: 25 October 2001 15:36 > To: Ren? Scharfe > Cc: Linus Torvalds; Linux Kernel Mailing List > Subject: Re: [PATCH] strtok --> strsep in framebuffer drivers (part 2) > > Ren? Scharfe wrote: > > > > Hello, > > > > I just noticed two framebuffer drivers with strtok calls > > that somehow passed below my radar (cscope). Patch below > > converts them, too. And it re-adds "ignore empty tokens" > > functionalty, which I forgot about the last time. Please apply. > > > > Ren? [snip] > > diff -Nur ../linux-2.4.13-pre6/drivers/video/riva/fbdev.c > ./drivers/video/riva/fbdev.c > > --- ../linux-2.4.13-pre6/drivers/video/riva/fbdev.c Tue > Oct 23 22:13:43 2001 > > +++ ./drivers/video/riva/fbdev.c Tue Oct 23 23:31:33 2001 > > @@ -2046,6 +2046,8 @@ > > return 0; > > > > while (this_opt = strsep(&options, ",")) { > > + if (!*this_opt) > > + continue; > > NAME > strsep - extract token from string > [...] > RETURN VALUE > The strsep() function returns a pointer to the token, or > NULL if delim is not found in stringp. > > If strsep returns NULL, and you dereference it -> Oops. > > > ! if (!this_opt) > continue; If strsep() returns NULL, then the while-loop will terminate. Thus this is already taken care of. //Peter - 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/