Date: Fri, 12 Feb 2016 17:04:04 +0000 (UTC) From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r295567 - head/sys/arm/mv Message-ID: <201602121704.u1CH44Xm061199@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andrew Date: Fri Feb 12 17:04:03 2016 New Revision: 295567 URL: https://svnweb.freebsd.org/changeset/base/295567 Log: Stop adding an extra null terminator to strings, OF_getprop already returns a null terminated string. Modified: head/sys/arm/mv/twsi.c Modified: head/sys/arm/mv/twsi.c ============================================================================== --- head/sys/arm/mv/twsi.c Fri Feb 12 17:03:24 2016 (r295566) +++ head/sys/arm/mv/twsi.c Fri Feb 12 17:04:03 2016 (r295567) @@ -401,10 +401,9 @@ mv_twsi_attach(device_t dev) for (child = OF_child(ofw_bus_get_node(dev)); child != 0; child = OF_peer(child)) { len = OF_getproplen(child, "model"); - if (len <= 0 || len > sizeof(dname) - 1) + if (len <= 0 || len > sizeof(dname)) continue; error = OF_getprop(child, "model", &dname, len); - dname[len + 1] = '\0'; if (error == -1) continue; len = strlen(dname); @@ -428,10 +427,9 @@ mv_twsi_attach(device_t dev) /* Get device driver name. */ len = OF_getproplen(child, "model"); - if (len <= 0 || len > sizeof(dname) - 1) + if (len <= 0 || len > sizeof(dname)) continue; OF_getprop(child, "model", &dname, len); - dname[len + 1] = '\0'; if (bootverbose) device_printf(dev, "adding a device %s at %d.\n",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602121704.u1CH44Xm061199>