Fix and invalid array indexing in isp_csi2_complexio_lanes_config
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.
Signed-off-by Michael Trimarchi <[email protected]>
cc akari Ailus <[email protected]>
cc Sergio Aguirre <[email protected]>
---
drivers/media/video/isp/ispcsi2.c +4 -2
@@ -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;
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 inisp_csi2_complexio_lanes_config