X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fvideo%2Fsm501fb.c;h=dcd98793d5681e14e7521e1f9efcf92806fe4f8b;hb=576ed7b5696b9435e8e6a6ec0c57da1f19c7e469;hp=f94ae84a58cd54eabd267a9e4d33384b346755ec;hpb=af7a535688a758d15f06a98833e6a143b29af9de;p=linux-2.6-omap-h63xx.git diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c index f94ae84a58c..dcd98793d56 100644 --- a/drivers/video/sm501fb.c +++ b/drivers/video/sm501fb.c @@ -159,6 +159,9 @@ static int sm501_alloc_mem(struct sm501fb_info *inf, struct sm501_mem *mem, break; case SM501_MEMF_PANEL: + if (size > inf->fbmem_len) + return -ENOMEM; + ptr = inf->fbmem_len - size; fbi = inf->fb[HEAD_CRT]; @@ -172,9 +175,6 @@ static int sm501_alloc_mem(struct sm501fb_info *inf, struct sm501_mem *mem, if (fbi && ptr < fbi->fix.smem_len) return -ENOMEM; - if (ptr < 0) - return -ENOMEM; - break; case SM501_MEMF_CRT: