* [PATCH 2/7] fbdev: Make fb_find_mode() return failure if modular
@ 2005-02-17 12:47 Antonino A. Daplas
2005-02-17 14:29 ` David Vrabel
0 siblings, 1 reply; 5+ messages in thread
From: Antonino A. Daplas @ 2005-02-17 12:47 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linux Fbdev development list
A few drivers call fb_find_mode() even if compiled as a module. If the
modedb parameter is NULL, the function will use default modedb array which
is marked __init. This will cause a crash. To avoid this, check if the
driver is compiled as a module, and if it is, fail.
Signed-off-by: Antonino Daplas <adaplas@pol.net>
---
modedb.c | 4 ++++
1 files changed, 4 insertions(+)
diff -Nru a/drivers/video/modedb.c b/drivers/video/modedb.c
--- a/drivers/video/modedb.c 2005-02-17 19:29:47 +08:00
+++ b/drivers/video/modedb.c 2005-02-15 22:54:57 +08:00
@@ -474,11 +474,15 @@
{
int i;
+ if (!db && (info->flags & FBINFO_MODULE))
+ return 0;
+
/* Set up defaults */
if (!db) {
db = modedb;
dbsize = sizeof(modedb)/sizeof(*modedb);
}
+
if (!default_mode)
default_mode = &modedb[DEFAULT_MODEDB_INDEX];
if (!default_bpp)
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/7] fbdev: Make fb_find_mode() return failure if modular
2005-02-17 12:47 [PATCH 2/7] fbdev: Make fb_find_mode() return failure if modular Antonino A. Daplas
@ 2005-02-17 14:29 ` David Vrabel
2005-02-17 21:07 ` Antonino A. Daplas
0 siblings, 1 reply; 5+ messages in thread
From: David Vrabel @ 2005-02-17 14:29 UTC (permalink / raw)
To: linux-fbdev-devel
Antonino A. Daplas wrote:
> A few drivers call fb_find_mode() even if compiled as a module. If the
> modedb parameter is NULL, the function will use default modedb array which
> is marked __init. This will cause a crash. To avoid this, check if the
> driver is compiled as a module, and if it is, fail.
Why limit the default mode DB to built-in drivers only?
David Vrabel
--
David Vrabel, Design Engineer
Arcom, Clifton Road Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK Web: http://www.arcom.com/
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/7] fbdev: Make fb_find_mode() return failure if modular
2005-02-17 14:29 ` David Vrabel
@ 2005-02-17 21:07 ` Antonino A. Daplas
2005-02-17 22:09 ` James Simmons
0 siblings, 1 reply; 5+ messages in thread
From: Antonino A. Daplas @ 2005-02-17 21:07 UTC (permalink / raw)
To: linux-fbdev-devel, David Vrabel
On Thursday 17 February 2005 22:29, David Vrabel wrote:
> Antonino A. Daplas wrote:
> > A few drivers call fb_find_mode() even if compiled as a module. If the
> > modedb parameter is NULL, the function will use default modedb array
> > which is marked __init. This will cause a crash. To avoid this, check if
> > the driver is compiled as a module, and if it is, fail.
>
> Why limit the default mode DB to built-in drivers only?
The default db is used by drivers only once. After that, it just consumes
memory.
Tony
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/7] fbdev: Make fb_find_mode() return failure if modular
2005-02-17 21:07 ` Antonino A. Daplas
@ 2005-02-17 22:09 ` James Simmons
2005-02-17 23:38 ` Antonino A. Daplas
0 siblings, 1 reply; 5+ messages in thread
From: James Simmons @ 2005-02-17 22:09 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: David Vrabel
> On Thursday 17 February 2005 22:29, David Vrabel wrote:
> > Antonino A. Daplas wrote:
> > > A few drivers call fb_find_mode() even if compiled as a module. If the
> > > modedb parameter is NULL, the function will use default modedb array
> > > which is marked __init. This will cause a crash. To avoid this, check if
> > > the driver is compiled as a module, and if it is, fail.
> >
> > Why limit the default mode DB to built-in drivers only?
>
> The default db is used by drivers only once. After that, it just consumes
> memory.
For modules it wouldn't be that hard to add the modedb from userland after
loading. First insmod your module. Normally modular fbdev driver don't set
the hardware explictly. Once we have sysfs it will be easy. Next send the
new modes to the db. Next select the mode you want.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/7] fbdev: Make fb_find_mode() return failure if modular
2005-02-17 22:09 ` James Simmons
@ 2005-02-17 23:38 ` Antonino A. Daplas
0 siblings, 0 replies; 5+ messages in thread
From: Antonino A. Daplas @ 2005-02-17 23:38 UTC (permalink / raw)
To: linux-fbdev-devel, James Simmons; +Cc: David Vrabel
On Friday 18 February 2005 06:09, James Simmons wrote:
> > On Thursday 17 February 2005 22:29, David Vrabel wrote:
> > > Antonino A. Daplas wrote:
> > > > A few drivers call fb_find_mode() even if compiled as a module. If
> > > > the modedb parameter is NULL, the function will use default modedb
> > > > array which is marked __init. This will cause a crash. To avoid
> > > > this, check if the driver is compiled as a module, and if it is,
> > > > fail.
> > >
> > > Why limit the default mode DB to built-in drivers only?
> >
> > The default db is used by drivers only once. After that, it just
> > consumes memory.
>
> For modules it wouldn't be that hard to add the modedb from userland after
> loading. First insmod your module. Normally modular fbdev driver don't set
> the hardware explictly. Once we have sysfs it will be easy. Next send the
> new modes to the db. Next select the mode you want.
>
Yes, also, modedb contains modes from different displays most of which
are unusable. If you want, you can create a private mode database for your
driver. See how rivafb, savagefb and radeonfb do it. In fact, all drivers
already have a private modelist, but if not explicitly created, will contain
only one entry, coming from info->var. Each time you use fbset, the
mode is automatically added to the modelist.
Tony
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-02-17 23:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-17 12:47 [PATCH 2/7] fbdev: Make fb_find_mode() return failure if modular Antonino A. Daplas
2005-02-17 14:29 ` David Vrabel
2005-02-17 21:07 ` Antonino A. Daplas
2005-02-17 22:09 ` James Simmons
2005-02-17 23:38 ` Antonino A. Daplas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).