Author: zbb Date: Mon Jan 25 14:42:44 2016 New Revision: 294729 URL: https://svnweb.freebsd.org/changeset/base/294729
Log: Do not destroy input buffer of the OF_getencprop() function on error Currently when the OF_getprop() function returns with error, the caller (OF_getencprop()) still changes the buffer endiannes. This may destroy the default value passed in the input buffer if used on a Little Endian platform. Reviewed by: mmel Submitted by: Zbigniew Bodek <z...@semihalf.com> Obtained from: Semihalf Sponsored by: Cavium Modified: head/sys/dev/ofw/openfirm.c Modified: head/sys/dev/ofw/openfirm.c ============================================================================== --- head/sys/dev/ofw/openfirm.c Mon Jan 25 14:13:28 2016 (r294728) +++ head/sys/dev/ofw/openfirm.c Mon Jan 25 14:42:44 2016 (r294729) @@ -394,6 +394,9 @@ OF_getencprop(phandle_t node, const char KASSERT(len % 4 == 0, ("Need a multiple of 4 bytes")); retval = OF_getprop(node, propname, buf, len); + if (retval <= 0) + return (retval); + for (i = 0; i < len/4; i++) buf[i] = be32toh(buf[i]); _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"