Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Apr 2016 23:17:06 +0000 (UTC)
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r297794 - head/sys/dev/gpio
Message-ID:  <201604102317.u3ANH6Gg094374@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gonzo
Date: Sun Apr 10 23:17:06 2016
New Revision: 297794
URL: https://svnweb.freebsd.org/changeset/base/297794

Log:
  Fix IIC "how" argument dereferencing on big-endian platforms
  
  "how" argument is passed as value of int* pointer to callback
  function but dereferenced as char* so only one byte taken into
  into account. On little-endian systems it happens to work because
  first byte is LSB that contains actual value, on big-endian it's
  MSB and in this case it's always equal zero
  
  PR:		207786
  Submitted by:	chadf@triularity.org

Modified:
  head/sys/dev/gpio/gpioiic.c

Modified: head/sys/dev/gpio/gpioiic.c
==============================================================================
--- head/sys/dev/gpio/gpioiic.c	Sun Apr 10 23:07:00 2016	(r297793)
+++ head/sys/dev/gpio/gpioiic.c	Sun Apr 10 23:17:06 2016	(r297794)
@@ -157,7 +157,7 @@ gpioiic_callback(device_t dev, int index
 	int error, how;
 
 	how = GPIOBUS_DONTWAIT;
-	if (data != NULL && (int)*data == IIC_WAIT)
+	if (data != NULL && *(int*)data == IIC_WAIT)
 		how = GPIOBUS_WAIT;
 	error = 0;
 	switch (index) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604102317.u3ANH6Gg094374>