Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1584563

[PATCH] omap3isp: avoid uninitialized memory

From Pavel Machek <pavel@ucw.cz>
Newsgroups linux.kernel
Subject [PATCH] omap3isp: avoid uninitialized memory
Date 2017-02-20 13:10 +0100
Message-ID <tcUWZ-4uF-9@gated-at.bofh.it> (permalink)
References <t8Aau-Kl-5@gated-at.bofh.it> <t8Irn-5Hm-5@gated-at.bofh.it> <tb4nM-6Eg-1@gated-at.bofh.it> <tcKuB-5Yh-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Code in ispcsiphy is quite confusing, and does not initialize phy1 in
case of isp rev. 2. Set it to zero, to prevent confusion.

Signed-off-by: Pavel Machek <pavel@ucw.cz>

index 8f73f6d..a2474b6 100644
--- a/drivers/media/platform/omap3isp/ispcsiphy.c
+++ b/drivers/media/platform/omap3isp/ispcsiphy.c
@@ -362,14 +374,16 @@ int omap3isp_csiphy_init(struct isp_device *isp)
 	phy2->phy_regs = OMAP3_ISP_IOMEM_CSIPHY2;
 	mutex_init(&phy2->mutex);
 
-	if (isp->revision == ISP_REVISION_15_0) {
-		phy1->isp = isp;
-		phy1->csi2 = &isp->isp_csi2c;
-		phy1->num_data_lanes = ISP_CSIPHY1_NUM_DATA_LANES;
-		phy1->cfg_regs = OMAP3_ISP_IOMEM_CSI2C_REGS1;
-		phy1->phy_regs = OMAP3_ISP_IOMEM_CSIPHY1;
-		mutex_init(&phy1->mutex);
+	if (isp->revision != ISP_REVISION_15_0) {
+		memset(phy1, sizeof(*phy1), 0);
+		return 0;
 	}
 
+	phy1->isp = isp;
+	phy1->csi2 = &isp->isp_csi2c;
+	phy1->num_data_lanes = ISP_CSIPHY1_NUM_DATA_LANES;
+	phy1->cfg_regs = OMAP3_ISP_IOMEM_CSI2C_REGS1;
+	phy1->phy_regs = OMAP3_ISP_IOMEM_CSIPHY1;
+	mutex_init(&phy1->mutex);
 	return 0;
 }


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] omap3isp: add support for CSI1 bus Pavel Machek <pavel@ucw.cz> - 2017-02-15 10:50 +0100
  Re: [PATCH] omap3isp: add support for CSI1 bus Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2017-02-20 02:00 +0100
    [PATCH] omap3isp: avoid uninitialized memory Pavel Machek <pavel@ucw.cz> - 2017-02-20 13:10 +0100
      Re: [PATCH] omap3isp: avoid uninitialized memory Sakari Ailus <sakari.ailus@iki.fi> - 2017-02-21 12:30 +0100

csiph-web