* [PATCH 02/18] fbdev: Pan display fixes
@ 2005-12-10 6:09 Antonino A. Daplas
2005-12-10 8:23 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Antonino A. Daplas @ 2005-12-10 6:09 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linux Fbdev development list
- Fix fb_pan_display rejecting yoffsets that are valid if panning mode
is ywrap.
- Add more robust error checking in fb_pan_display specially since this
function is accessible by userland apps.
Signed-off-by: Antonino Daplas <adaplas@pol.net>
---
drivers/video/fbmem.c | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 6240aed..10dfdf0 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -722,14 +722,30 @@ static void try_to_load(int fb)
int
fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
{
+ struct fb_fix_screeninfo *fix = &info->fix;
int xoffset = var->xoffset;
int yoffset = var->yoffset;
- int err;
+ int err = 0, yres = info->var.yres;
+
+ if (var->yoffset > 0) {
+ if (var->vmode & FB_VMODE_YWRAP) {
+ if (!fix->ywrapstep || (var->yoffset % fix->ywrapstep))
+ err = -EINVAL;
+ else
+ yres = 0;
+ } else if (!fix->ypanstep || (var->yoffset % fix->ypanstep))
+ err = -EINVAL;
+ }
+
+ if (var->xoffset > 0 && (!fix->xpanstep ||
+ (var->xoffset % fix->xpanstep)))
+ err = -EINVAL;
+
+ if (err || !info->fbops->fb_pan_display || xoffset < 0 ||
+ yoffset < 0 || var->yoffset + yres > info->var.yres_virtual ||
+ var->xoffset + info->var.xres > info->var.xres_virtual)
+ return -EINVAL;
- if (xoffset < 0 || yoffset < 0 || !info->fbops->fb_pan_display ||
- xoffset + info->var.xres > info->var.xres_virtual ||
- yoffset + info->var.yres > info->var.yres_virtual)
- return -EINVAL;
if ((err = info->fbops->fb_pan_display(var, info)))
return err;
info->var.xoffset = var->xoffset;
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 02/18] fbdev: Pan display fixes
2005-12-10 6:09 [PATCH 02/18] fbdev: Pan display fixes Antonino A. Daplas
@ 2005-12-10 8:23 ` Andrew Morton
2005-12-10 14:24 ` Antonino A. Daplas
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2005-12-10 8:23 UTC (permalink / raw)
To: Antonino A. Daplas; +Cc: linux-fbdev-devel
"Antonino A. Daplas" <adaplas@gmail.com> wrote:
>
> @@ -722,14 +722,30 @@ static void try_to_load(int fb)
> int
> fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
> {
> + struct fb_fix_screeninfo *fix = &info->fix;
> int xoffset = var->xoffset;
> int yoffset = var->yoffset;
> - int err;
> + int err = 0, yres = info->var.yres;
> +
> + if (var->yoffset > 0) {
Something horrid has happened to your whitespace.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 02/18] fbdev: Pan display fixes
2005-12-10 8:23 ` Andrew Morton
@ 2005-12-10 14:24 ` Antonino A. Daplas
0 siblings, 0 replies; 3+ messages in thread
From: Antonino A. Daplas @ 2005-12-10 14:24 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-fbdev-devel
Andrew Morton wrote:
> "Antonino A. Daplas" <adaplas@gmail.com> wrote:
>> @@ -722,14 +722,30 @@ static void try_to_load(int fb)
>> int
>> fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
>> {
>> + struct fb_fix_screeninfo *fix = &info->fix;
>> int xoffset = var->xoffset;
>> int yoffset = var->yoffset;
>> - int err;
>> + int err = 0, yres = info->var.yres;
>> +
>> + if (var->yoffset > 0) {
>
> Something horrid has happened to your whitespace.
>
It's the original that is using spaces instead of tabs. I did
not notice it though until you mentioned it.
Tony
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-12-10 14:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-10 6:09 [PATCH 02/18] fbdev: Pan display fixes Antonino A. Daplas
2005-12-10 8:23 ` Andrew Morton
2005-12-10 14:24 ` 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).