lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 2 Dec 2008 14:05:37 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	roel kluin <roel.kluin@...il.com>
Cc:	ben-linux@...ff.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sm501: unsigned ptr cannot be negative

On Sat, 29 Nov 2008 06:49:20 -0500
roel kluin <roel.kluin@...il.com> wrote:

> unsigned ptr cannot be negative
> 
> Signed-off-by: Roel Kluin <roel.kluin@...il.com>
> ---
> diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
> index f94ae84..dcd9879 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:

Looks OK.

Also this:

	if (ptr > 0)
		ptr &= ~(PAGE_SIZE - 1);

could just be

	ptr = PAGE_ALIGN(ptr);					
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ