svn commit: r297794 - head/sys/dev/gpio

Oleksandr Tymoshenko gonzo at FreeBSD.org
Sun Apr 10 23:17:07 UTC 2016


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 at 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) {


More information about the svn-src-all mailing list