Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7592181005261c3d90398375ab6922f56cdd2bad
Commit:     7592181005261c3d90398375ab6922f56cdd2bad
Parent:     11494543a5775b4764d0172084092715a533a8ce
Author:     Antonino A. Daplas <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 04:05:35 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 10:23:12 2007 -0700

    cyblafb: fix pseudo_palette array overrun in setcolreg
    
    The pseudo_palette has only 16 elements. Do not write if regno (the array
    index) is more than 15.
    
    Signed-off-by: Antonino Daplas <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/video/cyblafb.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/video/cyblafb.c b/drivers/video/cyblafb.c
index 94a66c2..e23324d 100644
--- a/drivers/video/cyblafb.c
+++ b/drivers/video/cyblafb.c
@@ -1068,15 +1068,18 @@ static int cyblafb_setcolreg(unsigned regno, unsigned 
red, unsigned green,
                out8(0x3C9, green >> 10);
                out8(0x3C9, blue >> 10);
 
-       } else if (bpp == 16)   // RGB 565
-               ((u32 *) info->pseudo_palette)[regno] =
-                   (red & 0xF800) |
-                   ((green & 0xFC00) >> 5) | ((blue & 0xF800) >> 11);
-       else if (bpp == 32)     // ARGB 8888
-               ((u32 *) info->pseudo_palette)[regno] =
-                   ((transp & 0xFF00) << 16) |
-                   ((red & 0xFF00) << 8) |
-                   ((green & 0xFF00)) | ((blue & 0xFF00) >> 8);
+       } else if (regno < 16) {
+               if (bpp == 16)  // RGB 565
+                       ((u32 *) info->pseudo_palette)[regno] =
+                               (red & 0xF800) |
+                               ((green & 0xFC00) >> 5) |
+                               ((blue & 0xF800) >> 11);
+               else if (bpp == 32)     // ARGB 8888
+                       ((u32 *) info->pseudo_palette)[regno] =
+                               ((transp & 0xFF00) << 16) |
+                               ((red & 0xFF00) << 8) |
+                               ((green & 0xFF00)) | ((blue & 0xFF00) >> 8);
+       }
 
        return 0;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to