Date: Mon, 25 Jan 2016 14:42:44 +0000 (UTC) From: Zbigniew Bodek <zbb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294729 - head/sys/dev/ofw Message-ID: <201601251442.u0PEgi2t025216@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <zbb@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]);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601251442.u0PEgi2t025216>