Skip to content

Commit

Permalink
sm501: unsigned ptr cannot be negative
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
roel kluin authored and Linus Torvalds committed Jan 6, 2009
1 parent fd00205 commit c00b1b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/video/sm501fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand All @@ -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:
Expand Down

0 comments on commit c00b1b7

Please sign in to comment.