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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161025190408.5012-1-colin.king@canonical.com>
Date:   Tue, 25 Oct 2016 20:04:08 +0100
From:   Colin King <colin.king@...onical.com>
To:     Jonathan Cameron <jic23@...nel.org>,
        Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        sayli karnik <karniksayli1995@...il.com>,
        Matt Ranostay <mranostay@...il.com>,
        Wei Yongjun <weiyongjun1@...wei.com>, linux-iio@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org
Subject: [PATCH] iio: maxim_thermocouple: return -EINVAL on invalid read size

From: Colin Ian King <colin.king@...onical.com>

In the case that the read size is not 2 or 4 bytes
then maxim_thermocouple_read is not initializing ret and
hence may return early with a bogus error return or
just through to return with a bogos unread value in *val.
Fix this by setting ret to -EINVAL for invalid (unhandled)
read sizes.

Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
 drivers/iio/temperature/maxim_thermocouple.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/temperature/maxim_thermocouple.c b/drivers/iio/temperature/maxim_thermocouple.c
index 066161a..f962f31 100644
--- a/drivers/iio/temperature/maxim_thermocouple.c
+++ b/drivers/iio/temperature/maxim_thermocouple.c
@@ -136,6 +136,8 @@ static int maxim_thermocouple_read(struct maxim_thermocouple_data *data,
 		ret = spi_read(data->spi, (void *)&buf32, storage_bytes);
 		*val = be32_to_cpu(buf32);
 		break;
+	default:
+		ret = -EINVAL;
 	}
 
 	if (ret)
-- 
2.9.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ