fbdev: Make fb_find_mode() return failure if modular
PATCH 2/7 fbdev: Make fb_find_mode() return failure if modular
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.
---
modedb.c | 4 ++++ 1 files changed, 4 insertions(+)
drivers/video/modedb.c +4 -0
@@ -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
Quoted 4 lines · Antonino A. Daplas
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
Signature · 11 lines
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
Quoted 7 lines · David Vrabel
Quoted 4 lines · Antonino A. Daplas
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
Quoted 8 lines · David Vrabel
Quoted 6 lines
Quoted 4 lines · Antonino A. Daplas
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.
Quoted 4 lines
Quoted 1 line
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
Quoted 10 lines · James Simmons
Quoted 10 lines · David Vrabel
Quoted 8 lines
Quoted 5 lines · Antonino A. Daplas
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?
Quoted 8 lines
Quoted 2 lines
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