vfb: only enable if explicitly requested when compiled in
authorFrans Pop <elendil@planet.nl>
Thu, 24 Jul 2008 04:31:26 +0000 (21:31 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Jul 2008 17:47:39 +0000 (10:47 -0700)
The Kconfig help for the vfb driver says:
   Do NOT enable it for normal systems! To protect the innocent, it
   has to be enabled explicitly at boot time using the kernel option
   `video=vfb:'.

This change lets the code match the description.

Support for vfb:disable is kept for backwards compatibility; vfb:off works
because it is tested at a higher level.

Note: any undefined option (e.g. vfb:enable) will also enable this driver.

The relevant code has been unchanged since before the migration to
git (2.6.12).

This patch fixes bugzilla #9310 and was the root cause behind
http://lkml.org/lkml/2008/5/31/220.

Signed-off-by: Frans Pop <elendil@planet.nl>
Cc: Antonino A. Daplas <adaplas@gmail.com>
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/vfb.c

index 072638a..93fe08d 100644 (file)
@@ -443,19 +443,29 @@ static int vfb_mmap(struct fb_info *info,
 }
 
 #ifndef MODULE
 }
 
 #ifndef MODULE
+/*
+ * The virtual framebuffer driver is only enabled if explicitly
+ * requested by passing 'video=vfb:' (or any actual options).
+ */
 static int __init vfb_setup(char *options)
 {
        char *this_opt;
 
 static int __init vfb_setup(char *options)
 {
        char *this_opt;
 
+       vfb_enable = 0;
+
+       if (!options)
+               return 1;
+
        vfb_enable = 1;
 
        vfb_enable = 1;
 
-       if (!options || !*options)
+       if (!*options)
                return 1;
 
        while ((this_opt = strsep(&options, ",")) != NULL) {
                if (!*this_opt)
                        continue;
                return 1;
 
        while ((this_opt = strsep(&options, ",")) != NULL) {
                if (!*this_opt)
                        continue;
-               if (!strncmp(this_opt, "disable", 7))
+               /* Test disable for backwards compatibility */
+               if (!strcmp(this_opt, "disable"))
                        vfb_enable = 0;
        }
        return 1;
                        vfb_enable = 0;
        }
        return 1;