@@ -383,6 +383,7 @@ static const struct fb_fix_screeninfo aty128fb_fix = {
.accel = FB_ACCEL_ATI_RAGE128,
};
+static char *mode_option_buf;
static char *mode_option = NULL;
#ifdef CONFIG_PPC_PMAC
@@ -1723,7 +1724,11 @@ static int aty128fb_setup(char *options)
continue;
}
#endif /* CONFIG_PPC_PMAC */
- mode_option = this_opt;
+ {
+ kfree(mode_option_buf);
+ mode_option_buf = kstrdup(this_opt, GFP_KERNEL); // ignore errors
+ mode_option = mode_option_buf;
+ }
}
return 0;
}
@@ -2518,6 +2523,7 @@ static int aty128fb_init(void)
static void __exit aty128fb_exit(void)
{
pci_unregister_driver(&aty128fb_driver);
+ kfree(mode_option_buf);
}
module_init(aty128fb_init);
@@ -326,6 +326,7 @@ static int pll;
static int mclk;
static int xclk;
static int comp_sync = -1;
+static char *mode_buf;
static char *mode;
static int backlight = IS_BUILTIN(CONFIG_PMAC_BACKLIGHT);
@@ -3896,8 +3897,11 @@ static int __init atyfb_setup(char *options)
}
}
#endif
- else
- mode = this_opt;
+ else {
+ kfree(mode_buf);
+ mode_buf = kstrdup(this_opt, GFP_KERNEL); // ignore errors
+ mode = mode_buf;
+ }
}
return 0;
}
@@ -3995,6 +3999,7 @@ static void __exit atyfb_exit(void)
#ifdef CONFIG_PCI
pci_unregister_driver(&atyfb_driver);
#endif
+ kfree(mode_buf);
}
module_init(atyfb_init);
@@ -257,6 +257,7 @@ static reg_val common_regs[] = {
* globals
*/
+static char *mode_option_buf;
static char *mode_option;
static char *monitor_layout;
static bool noaccel = 0;
@@ -2596,8 +2597,11 @@ static int __init radeonfb_setup (char *options)
} else if (!strncmp(this_opt, "ignore_devlist", 14)) {
ignore_devlist = 1;
#endif
- } else
- mode_option = this_opt;
+ } else {
+ kfree(mode_option_buf);
+ mode_option_buf = kstrdup(this_opt, GFP_KERNEL); // ignore errors
+ mode_option = mode_option_buf;
+ }
}
return 0;
}
@@ -2624,6 +2628,7 @@ static int __init radeonfb_init (void)
static void __exit radeonfb_exit (void)
{
pci_unregister_driver (&radeonfb_driver);
+ kfree(mode_option_buf);
}
module_init(radeonfb_init);
Assume that the drivers do not own the option string or its substrings and hence duplicate the option string for the video mode. Allocate the copy's memory with kstrdup() and free it in each module's exit function. Done in preparation of switching the driver to struct option_iter and constifying the option string. v2: * replace static memory with kstrdup()/kfree() (Geert) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> --- drivers/video/fbdev/aty/aty128fb.c | 8 +++++++- drivers/video/fbdev/aty/atyfb_base.c | 9 +++++++-- drivers/video/fbdev/aty/radeon_base.c | 9 +++++++-- 3 files changed, 21 insertions(+), 5 deletions(-)