Skip to contentSkip to conversation

Fix and invalid array indexing in isp_csi2_complexio_lanes_config

RFC PATCH In review Michael Trimarchi 2 participants 2 messages Jan 12, 2010 – Jan 13, 2010 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Fix and invalid array indexing in isp_csi2_complexio_lanes_config

Fix and invalid array indexing when refcfg->data[i].pos is equal to 0. The code access an invalid location.

cc akari Ailus <[email protected]>
cc Sergio Aguirre <[email protected]>

---

drivers/media/video/isp/ispcsi2.c +4 -2
index fb0f44f..cc8fa39 100644
@@ -85,8 +85,10 @@ int isp_csi2_complexio_lanes_config(struct isp_csi2_device *isp_csi2,
 			       " parameters for data lane #%d\n", i);
 			goto err_einval;
 		}
-		if (pos_occupied[reqcfg->data[i].pos - 1] &&
-		    reqcfg->data[i].pos > 0) {
+		if (!reqcfg->data[i].pos)
+			continue;
+
+		if (pos_occupied[reqcfg->data[i].pos - 1]) {
 			printk(KERN_ERR "Lane #%d already occupied\n",
 			       reqcfg->data[i].pos);
 			goto err_einval;
#1 lore raw

Nice catch!

Patch looks good to me.

I'm pushing it into my omap-devel branch, which I'll later rebase to latest Sakari's tree and send among other patches I have in my queue for him.

Regards,
Sergio

Quoted 8 lines

-----Original Message-----
From: Michael Trimarchi [mailto:[email protected]]
Sent: Tuesday, January 12, 2010 2:23 PM
To: Sakari Ailus; Aguirre, Sergio
Cc: [email protected]
Subject: [RFC PATCH] Fix and invalid array indexing in isp_csi2_complexio_lanes_config