From: "Peter Wächtler" <pwaechtler@loewe-komp.de>
To: "René Scharfe" <l.s.r@web.de>
Cc: Linus Torvalds <torvalds@transmeta.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] strtok --> strsep in framebuffer drivers (part 2)
Date: Thu, 25 Oct 2001 15:36:14 +0200 [thread overview]
Message-ID: <3BD8154E.24511282@loewe-komp.de> (raw)
In-Reply-To: <m15wXDA-007qbNC@smtp.web.de>
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é
>
> diff -Nur ../linux-2.4.13-pre6/drivers/video/amifb.c ./drivers/video/amifb.c
> --- ../linux-2.4.13-pre6/drivers/video/amifb.c Tue Oct 23 22:13:43 2001
> +++ ./drivers/video/amifb.c Tue Oct 23 23:04:03 2001
> @@ -1193,6 +1193,8 @@
> return 0;
>
> while (this_opt = strsep(&options, ",")) {
> + if (!*this_opt)
> + continue;
> if (!strcmp(this_opt, "inverse")) {
> amifb_inverse = 1;
> fb_invert_cmaps();
> diff -Nur ../linux-2.4.13-pre6/drivers/video/atafb.c ./drivers/video/atafb.c
> --- ../linux-2.4.13-pre6/drivers/video/atafb.c Fri Sep 14 01:04:43 2001
> +++ ./drivers/video/atafb.c Tue Oct 23 23:00:59 2001
> @@ -2899,7 +2899,7 @@
> if (!options || !*options)
> return 0;
>
> - for(this_opt=strtok(options,","); this_opt; this_opt=strtok(NULL,",")) {
> + while (this_opt = strsep(&options, ",")) {
> if (!*this_opt) continue;
> if ((temp=get_video_mode(this_opt)))
> default_par=temp;
> diff -Nur ../linux-2.4.13-pre6/drivers/video/aty/atyfb_base.c ./drivers/video/aty/atyfb_base.c
> --- ../linux-2.4.13-pre6/drivers/video/aty/atyfb_base.c Tue Oct 23 22:13:43 2001
> +++ ./drivers/video/aty/atyfb_base.c Tue Oct 23 23:05:24 2001
> @@ -2522,6 +2522,8 @@
> return 0;
>
> while (this_opt = strsep(&options, ",")) {
> + if (!*this_opt)
> + continue;
> if (!strncmp(this_opt, "font:", 5)) {
> char *p;
> int i;
> diff -Nur ../linux-2.4.13-pre6/drivers/video/aty128fb.c ./drivers/video/aty128fb.c
> --- ../linux-2.4.13-pre6/drivers/video/aty128fb.c Tue Oct 23 22:13:43 2001
> +++ ./drivers/video/aty128fb.c Tue Oct 23 23:06:17 2001
> @@ -1614,6 +1614,8 @@
> return 0;
>
> while (this_opt = strsep(&options, ",")) {
> + if (!*this_opt)
> + continue;
> if (!strncmp(this_opt, "font:", 5)) {
> char *p;
> int i;
> diff -Nur ../linux-2.4.13-pre6/drivers/video/clgenfb.c ./drivers/video/clgenfb.c
> --- ../linux-2.4.13-pre6/drivers/video/clgenfb.c Wed Oct 10 00:13:02 2001
> +++ ./drivers/video/clgenfb.c Tue Oct 23 22:59:38 2001
> @@ -2817,8 +2817,7 @@
> if (!options || !*options)
> return 0;
>
> - for (this_opt = strtok (options, ","); this_opt != NULL;
> - this_opt = strtok (NULL, ",")) {
> + while (this_opt = strsep (&options, ",")) {
> if (!*this_opt) continue;
>
> DPRINTK("clgenfb_setup: option '%s'\n", this_opt);
> diff -Nur ../linux-2.4.13-pre6/drivers/video/cyberfb.c ./drivers/video/cyberfb.c
> --- ../linux-2.4.13-pre6/drivers/video/cyberfb.c Tue Oct 23 22:13:43 2001
> +++ ./drivers/video/cyberfb.c Tue Oct 23 23:07:42 2001
> @@ -1023,6 +1023,8 @@
> }
>
> while (this_opt = strsep(&options, ",")) {
> + if (!*this_opt)
> + continue;
> if (!strcmp(this_opt, "inverse")) {
> Cyberfb_inverse = 1;
> fb_invert_cmaps();
> diff -Nur ../linux-2.4.13-pre6/drivers/video/radeonfb.c ./drivers/video/radeonfb.c
> --- ../linux-2.4.13-pre6/drivers/video/radeonfb.c Tue Oct 23 22:13:43 2001
> +++ ./drivers/video/radeonfb.c Tue Oct 23 23:09:58 2001
> @@ -538,6 +538,8 @@
> return 0;
>
> while (this_opt = strsep (&options, ",")) {
> + if (!*this_opt)
> + continue;
> if (!strncmp (this_opt, "font:", 5)) {
> char *p;
> int i;
> diff -Nur ../linux-2.4.13-pre6/drivers/video/retz3fb.c ./drivers/video/retz3fb.c
> --- ../linux-2.4.13-pre6/drivers/video/retz3fb.c Tue Oct 23 22:13:43 2001
> +++ ./drivers/video/retz3fb.c Tue Oct 23 23:30:56 2001
> @@ -1349,6 +1349,8 @@
> return 0;
>
> while (this_opt = strsep(&options, ",")) {
> + if (!*this_opt)
> + continue;
> if (!strcmp(this_opt, "inverse")) {
> z3fb_inverse = 1;
> fb_invert_cmaps();
> 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;
next prev parent reply other threads:[~2001-10-25 13:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-24 23:22 [PATCH] strtok --> strsep in framebuffer drivers (part 2) René Scharfe
2001-10-25 13:36 ` Peter Wächtler [this message]
2001-10-27 7:00 ` [off topic?] " Kari Hurtta
2001-10-27 7:55 ` Kari Hurtta
2001-10-29 5:34 ` Guest section DW
2001-10-29 7:12 ` Kari Hurtta
2001-10-29 14:07 ` Guest section DW
-- strict thread matches above, loose matches on Subject: below --
2001-10-25 13:44 Peter Kjellerstedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3BD8154E.24511282@loewe-komp.de \
--to=pwaechtler@loewe-komp.de \
--cc=l.s.r@web.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox