Author: leitao Date: Thu Jun 7 15:59:08 2018 New Revision: 334790 URL: https://svnweb.freebsd.org/changeset/base/334790
Log: dev/ofw: Fix ofw_fdt_getprop() return values to match documentation Fix the behavior of ofw_fdt_getprop() and ofw_fdt_getprop() functions to match the documentation as the non-fdt code. Submitted by: Luis Pires <lffpi...@ruabrasil.org> Reviewed by: manu, jhibbits Approved by: jhibbits (mentor) Differential Revision: https://reviews.freebsd.org/D15680 Modified: head/sys/dev/ofw/ofw_fdt.c Modified: head/sys/dev/ofw/ofw_fdt.c ============================================================================== --- head/sys/dev/ofw/ofw_fdt.c Thu Jun 7 15:51:23 2018 (r334789) +++ head/sys/dev/ofw/ofw_fdt.c Thu Jun 7 15:59:08 2018 (r334790) @@ -279,8 +279,6 @@ ofw_fdt_getprop(ofw_t ofw, phandle_t package, const ch /* Emulate the 'name' property */ name = fdt_get_name(fdtp, offset, &len); strncpy(buf, name, buflen); - if (len + 1 > buflen) - len = buflen; return (len + 1); } @@ -299,9 +297,8 @@ ofw_fdt_getprop(ofw_t ofw, phandle_t package, const ch if (prop == NULL) return (-1); - if (len > buflen) - len = buflen; - bcopy(prop, buf, len); + bcopy(prop, buf, min(len, buflen)); + return (len); } _______________________________________________ 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"