linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: stx104: Store channel output state values as int
@ 2016-07-13 14:43 William Breathitt Gray
  2016-07-24 13:06 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: William Breathitt Gray @ 2016-07-13 14:43 UTC (permalink / raw)
  To: jic23, knaack.h, lars, pmeerw; +Cc: linux-iio, linux-kernel

The val parameter has a data type of int in the read_raw and write_raw
callbacks. The chan_out_states array should have elements of type int in
order to match the data type of the val parameter.

This patch fixes a possible integer overflow condition when the the int
pointer val is dereferenced to store the unsigned int chan_out_states
element in the read_raw callback.

Fixes: 97a445dad37a ("iio: Add IIO support for the DAC on the Apex Embedded Systems STX104")
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
---
 drivers/iio/dac/stx104.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/dac/stx104.c b/drivers/iio/dac/stx104.c
index 792a971..b22b744 100644
--- a/drivers/iio/dac/stx104.c
+++ b/drivers/iio/dac/stx104.c
@@ -47,7 +47,7 @@ MODULE_PARM_DESC(base, "Apex Embedded Systems STX104 base addresses");
  * @base:		base port address of the IIO device
  */
 struct stx104_iio {
-	unsigned chan_out_states[STX104_NUM_CHAN];
+	int chan_out_states[STX104_NUM_CHAN];
 	unsigned base;
 };
 
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-25 12:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-13 14:43 [PATCH] iio: stx104: Store channel output state values as int William Breathitt Gray
2016-07-24 13:06 ` Jonathan Cameron
2016-07-25 12:41   ` William Breathitt Gray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).