Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a9e60e5c3c4721dd216047e4c58c4eb89789f519
Commit:     a9e60e5c3c4721dd216047e4c58c4eb89789f519
Parent:     43054412db5e5b3eda1eff6c2245ff4257560340
Author:     Adrian Bunk <[EMAIL PROTECTED]>
AuthorDate: Wed Nov 14 16:59:02 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Nov 14 18:45:38 2007 -0800

    video/sis/: fix negative array index
    
    This patch fixes the possible usage of a negative value as an array
    index spotted by the Coverity checker.
    
    sisfb_validate_mode() could return a negative error code and we must check 
for
    that prior to using its return value as an array index.
    
    Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>
    Cc: Thomas Winischhofer <[EMAIL PROTECTED]>
    Cc: "Antonino A. Daplas" <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/video/sis/sis_main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index bc7d236..37bd24b 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -1248,7 +1248,6 @@ sisfb_do_set_var(struct fb_var_screeninfo *var, int 
isactive, struct fb_info *in
        if(found_mode) {
                ivideo->sisfb_mode_idx = sisfb_validate_mode(ivideo,
                                ivideo->sisfb_mode_idx, ivideo->currentvbflags);
-               ivideo->mode_no = 
sisbios_mode[ivideo->sisfb_mode_idx].mode_no[ivideo->mni];
        } else {
                ivideo->sisfb_mode_idx = -1;
        }
@@ -1260,6 +1259,8 @@ sisfb_do_set_var(struct fb_var_screeninfo *var, int 
isactive, struct fb_info *in
                return -EINVAL;
        }
 
+       ivideo->mode_no = 
sisbios_mode[ivideo->sisfb_mode_idx].mode_no[ivideo->mni];
+
        if(sisfb_search_refresh_rate(ivideo, ivideo->refresh_rate, 
ivideo->sisfb_mode_idx) == 0) {
                ivideo->rate_idx = 
sisbios_mode[ivideo->sisfb_mode_idx].rate_idx;
                ivideo->refresh_rate = 60;
-
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