All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Linux-fbdev-devel] [PATCH] omapfb: invalid test on unsigned
  2009-06-22 20:35 [PATCH] omapfb: invalid test on unsigned Roel Kluin
@ 2009-06-22 19:35 ` Krzysztof Helt
  0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Helt @ 2009-06-22 19:35 UTC (permalink / raw)
  To: Roel Kluin; +Cc: imre.deak, Andrew Morton, linux-omap, linux-fbdev-devel

On Mon, 22 Jun 2009 22:35:59 +0200
Roel Kluin <roel.kluin@gmail.com> wrote:

> Unsigned regno cannot be less than 0.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Is this correct? please review.
> 

No. It is a case for truecolor modes. They do not use the cmap. 
Either remove the if clause completely or make it a an else clause for the next if

if (regno < 16) {
...
} else {
    r = -EINVAL;
}


The latter (the else clause) is a better solution.

Kind regards,
Krzysztof

> diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c
> index 060d72f..787271f 100644
> --- a/drivers/video/omap/omapfb_main.c
> +++ b/drivers/video/omap/omapfb_main.c
> @@ -276,7 +276,7 @@ static int _setcolreg(struct fb_info *info, u_int regno, u_int red, u_int green,
>  		if (r != 0)
>  			break;
>  
> -		if (regno < 0) {
> +		if (regno >= info->cmap.len) {
>  			r = -EINVAL;
>  			break;
>  		}
> 
> ------------------------------------------------------------------------------
> Are you an open source citizen? Join us for the Open Source Bridge conference!
> Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
> Need another reason to go? 24-hour hacker lounge. Register today!
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
> 

----------------------------------------------------------------------
Nowa akcja Pepsi - nagrody za kody spod nakretek. Zarejestruj sie!
http://link.interia.pl/f21cc 



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] omapfb: invalid test on unsigned
@ 2009-06-22 20:35 Roel Kluin
  2009-06-22 19:35 ` [Linux-fbdev-devel] " Krzysztof Helt
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-06-22 20:35 UTC (permalink / raw)
  To: imre.deak; +Cc: linux-fbdev-devel, linux-omap, Andrew Morton

Unsigned regno cannot be less than 0.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Is this correct? please review.

diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c
index 060d72f..787271f 100644
--- a/drivers/video/omap/omapfb_main.c
+++ b/drivers/video/omap/omapfb_main.c
@@ -276,7 +276,7 @@ static int _setcolreg(struct fb_info *info, u_int regno, u_int red, u_int green,
 		if (r != 0)
 			break;
 
-		if (regno < 0) {
+		if (regno >= info->cmap.len) {
 			r = -EINVAL;
 			break;
 		}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-22 20:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-22 20:35 [PATCH] omapfb: invalid test on unsigned Roel Kluin
2009-06-22 19:35 ` [Linux-fbdev-devel] " Krzysztof Helt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.