lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 3 Mar 2015 08:46:10 +0530
From:	Tapasweni Pathak <tapaswenipathak@...il.com>
To:	kyungmin.park@...sung.com, a.hajda@...sung.com,
	mchehab@....samsung.com, linux-media@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc:	tapaswenipathak@...il.com
Subject: [PATCH v2] drivers: media: i2c : s5c73m3: Fix null dereference

Replace dev_err statement which dereferences a null with pr_err_once.

Move if(!spi_dev) above if(dir...) block.

Found using Coccinelle.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@...il.com>
---
Changes since v1:
Replace pr_err with pr_err_once.
Move if(!spi_dev).
Reword commit message.
Reword subject.

 drivers/media/i2c/s5c73m3/s5c73m3-spi.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-spi.c b/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
index f60b265..376b78f 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
@@ -46,16 +46,16 @@ static int spi_xmit(struct spi_device *spi_dev, void *addr, const int len,
 		.len	= len,
 	};

+	if(!spi_dev) {
+		pr_err_once("SPI device is unintialized\n");
+		return -ENODEV;
+	}
+
 	if (dir == SPI_DIR_TX)
 		xfer.tx_buf = addr;
 	else
 		xfer.rx_buf = addr;

-	if (spi_dev == NULL) {
-		dev_err(&spi_dev->dev, "SPI device is uninitialized\n");
-		return -ENODEV;
-	}
-
 	spi_message_init(&msg);
 	spi_message_add_tail(&xfer, &msg);

--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ