ARM: tegra: fix out-of-bounds write
Deepak Nibade [Fri, 7 Dec 2012 12:39:11 +0000 (17:39 +0530)]
Fix Coverity issue
Coverity id : 21342
Coverity id : 21343
Coverity id : 21344

Bug 1046331

Change-Id: I7a990f4cf36020a416f5cf029a8874fe07dbf389
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/169387
(cherry picked from commit 5a9fcd2218f7751b77e73246aaa9e5840c4ae2b5)
Reviewed-on: http://git-master/r/188449
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

arch/arm/mach-tegra/board-cardhu-sensors.c
arch/arm/mach-tegra/board-dalmore-sensors.c
arch/arm/mach-tegra/board-enterprise-sensors.c
arch/arm/mach-tegra/board-kai-sensors.c
arch/arm/mach-tegra/board-pluto-sensors.c
arch/arm/mach-tegra/board-roth-sensors.c

index 53cfbb8..3062592 100644 (file)
@@ -793,7 +793,7 @@ static int cardhu_nct1008_init(void)
 
                        data->num_trips++;
 
-                       if (data->num_trips > NCT_MAX_TRIPS)
+                       if (data->num_trips >= NCT_MAX_TRIPS)
                                BUG();
                }
 #endif
index 512d369..eb3911a 100644 (file)
@@ -599,7 +599,7 @@ static int dalmore_nct1008_init(void)
 
                        data->num_trips++;
 
-                       if (data->num_trips > NCT_MAX_TRIPS)
+                       if (data->num_trips >= NCT_MAX_TRIPS)
                                BUG();
                }
 #endif
index bf28621..88124a7 100644 (file)
@@ -140,7 +140,7 @@ static void enterprise_init_edp_cdev(void)
 
                data->num_trips++;
 
-               if (data->num_trips > NCT_MAX_TRIPS)
+               if (data->num_trips >= NCT_MAX_TRIPS)
                        BUG();
        }
 }
index abf692d..de9b712 100644 (file)
@@ -122,7 +122,7 @@ static void kai_init_edp_cdev(void)
 
                data->num_trips++;
 
-               if (data->num_trips > NCT_MAX_TRIPS)
+               if (data->num_trips >= NCT_MAX_TRIPS)
                        BUG();
        }
 }
index 5c39cd5..74927ef 100644 (file)
@@ -790,7 +790,7 @@ static int pluto_nct1008_init(void)
 
                        data->num_trips++;
 
-                       if (data->num_trips > NCT_MAX_TRIPS)
+                       if (data->num_trips >= NCT_MAX_TRIPS)
                                BUG();
                }
 #endif
index 02d9482..ec13f72 100644 (file)
@@ -240,7 +240,7 @@ static int roth_nct1008_init(void)
 
                        data->num_trips++;
 
-                       if (data->num_trips > NCT_MAX_TRIPS)
+                       if (data->num_trips >= NCT_MAX_TRIPS)
                                BUG();
                }
 #endif