From: roel kluin Date: Tue, 6 Jan 2009 22:42:36 +0000 (-0800) Subject: sm501: unsigned ptr cannot be negative X-Git-Tag: v2.6.29-rc1~263 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=c00b1b7d19d335f96aa03ef2e4e71b7fb4fdb056;p=linux-2.6-omap-h63xx.git sm501: unsigned ptr cannot be negative unsigned ptr cannot be negative Signed-off-by: Roel Kluin Cc: Krzysztof Helt Cc: Ben Dooks Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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: