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: ch...@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) {
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to