aboutsummaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorroel kluin <roel.kluin@gmail.com>2009-01-06 14:42:36 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 15:59:27 -0800
commitc00b1b7d19d335f96aa03ef2e4e71b7fb4fdb056 (patch)
tree8980fe4965fcc0e4f6f36c538729c08b0eead697 /drivers/video
parentfd002050becd888e4dab419aa59a6484afe1d00b (diff)
sm501: unsigned ptr cannot be negative
unsigned ptr cannot be negative Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Cc: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/sm501fb.c6
1 files changed, 3 insertions, 3 deletions
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: