提交 c00b1b7d 编写于 作者: R roel kluin 提交者: Linus Torvalds

sm501: unsigned ptr cannot be negative

unsigned ptr cannot be negative
Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 fd002050
...@@ -159,6 +159,9 @@ static int sm501_alloc_mem(struct sm501fb_info *inf, struct sm501_mem *mem, ...@@ -159,6 +159,9 @@ static int sm501_alloc_mem(struct sm501fb_info *inf, struct sm501_mem *mem,
break; break;
case SM501_MEMF_PANEL: case SM501_MEMF_PANEL:
if (size > inf->fbmem_len)
return -ENOMEM;
ptr = inf->fbmem_len - size; ptr = inf->fbmem_len - size;
fbi = inf->fb[HEAD_CRT]; fbi = inf->fb[HEAD_CRT];
...@@ -172,9 +175,6 @@ static int sm501_alloc_mem(struct sm501fb_info *inf, struct sm501_mem *mem, ...@@ -172,9 +175,6 @@ static int sm501_alloc_mem(struct sm501fb_info *inf, struct sm501_mem *mem,
if (fbi && ptr < fbi->fix.smem_len) if (fbi && ptr < fbi->fix.smem_len)
return -ENOMEM; return -ENOMEM;
if (ptr < 0)
return -ENOMEM;
break; break;
case SM501_MEMF_CRT: case SM501_MEMF_CRT:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册