[OMAPZOOM] ISP: Fix indexing bug in csi2 module.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Dominic Curran <dcurran@xxxxxx>
Subject: [OMAPZOOM] ISP: Fix indexing bug in csi2 module.

This patch fixes an indexing bug in the CSI2 module.
The functions:
 isp_csi2_timings_update(..)
 isp_csi2_timings_get(..)
expect either a 1 or 2 which references the complexio number being referenced.
The bug was that they were being passed a 0 & 1.

The issue was originally found by HP.

Signed-off-by: Dominic Curran <dcurran@xxxxxx>
---
 drivers/media/video/isp/ispcsi2.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Index: omapzoom04/drivers/media/video/isp/ispcsi2.c
===================================================================
--- omapzoom04.orig/drivers/media/video/isp/ispcsi2.c
+++ omapzoom04/drivers/media/video/isp/ispcsi2.c
@@ -1526,7 +1526,7 @@ int isp_csi2_timings_config_forcerxmode(
 	struct isp_csi2_timings_cfg *currtimings;
 	struct isp_csi2_timings_cfg_update *currtimings_u;
 
-	if (io > 2) {
+	if (io < 1 || io > 2) {
 		printk(KERN_ERR "CSI2 - Timings config: Invalid IO number\n");
 		return -EINVAL;
 	}
@@ -1552,7 +1552,7 @@ int isp_csi2_timings_config_stopstate_16
 	struct isp_csi2_timings_cfg *currtimings;
 	struct isp_csi2_timings_cfg_update *currtimings_u;
 
-	if (io > 2) {
+	if (io < 1 || io > 2) {
 		printk(KERN_ERR "CSI2 - Timings config: Invalid IO number\n");
 		return -EINVAL;
 	}
@@ -1578,7 +1578,7 @@ int isp_csi2_timings_config_stopstate_4x
 	struct isp_csi2_timings_cfg *currtimings;
 	struct isp_csi2_timings_cfg_update *currtimings_u;
 
-	if (io > 2) {
+	if (io < 1 || io > 2) {
 		printk(KERN_ERR "CSI2 - Timings config: Invalid IO number\n");
 		return -EINVAL;
 	}
@@ -1604,7 +1604,7 @@ int isp_csi2_timings_config_stopstate_cn
 	struct isp_csi2_timings_cfg *currtimings;
 	struct isp_csi2_timings_cfg_update *currtimings_u;
 
-	if (io > 2) {
+	if (io < 1 || io > 2) {
 		printk(KERN_ERR "CSI2 - Timings config: Invalid IO number\n");
 		return -EINVAL;
 	}
@@ -1636,7 +1636,7 @@ int isp_csi2_timings_update(u8 io, bool 
 	struct isp_csi2_timings_cfg_update *currtimings_u;
 	u32 reg;
 
-	if (io > 2) {
+	if (io < 1 || io > 2) {
 		printk(KERN_ERR "CSI2 - Timings config: Invalid IO number\n");
 		return -EINVAL;
 	}
@@ -1706,7 +1706,7 @@ int isp_csi2_timings_get(u8 io)
 	struct isp_csi2_timings_cfg_update *currtimings_u;
 	u32 reg;
 
-	if (io > 2) {
+	if (io < 1 || io > 2) {
 		printk(KERN_ERR "CSI2 - Timings config: Invalid IO number\n");
 		return -EINVAL;
 	}
@@ -1758,7 +1758,7 @@ int isp_csi2_timings_update_all(bool for
 {
 	int i;
 
-	for (i = 0; i < 2; i++)
+	for (i = 1; i < 3; i++)
 		isp_csi2_timings_update(i, force_update);
 	return 0;
 }
@@ -1772,7 +1772,7 @@ int isp_csi2_timings_get_all(void)
 {
 	int i;
 
-	for (i = 0; i < 2; i++)
+	for (i = 1; i < 3; i++)
 		isp_csi2_timings_get(i);
 	return 0;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux