Date: Mon, 30 Mar 2015 09:49:55 +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: r280848 - head/sys/dev/ofw Message-ID: <201503300949.t2U9ntL9091425@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: zbb Date: Mon Mar 30 09:49:54 2015 New Revision: 280848 URL: https://svnweb.freebsd.org/changeset/base/280848 Log: Fix bug in xrefinfo_find() for 64-bit platforms uintptr_t may be 64-bit on some platforms, therefore when finding xrefinfo by pointer to device the high word is being cut off due to cast to phandle_t which is 32-bit long by definition. Due to that we loose the high word of the address to compare with xi->dev's address. To fix that, first argument of xrefinfo_find() is extended to uintptr_t and is being cast to appropriate type (phandle_t) when compared. Submitted by: Zbigniew Bodek <zbb@semihalf.com> Reviewed by: nwhitehorn Obtained from: Semihalf Modified: head/sys/dev/ofw/openfirm.c Modified: head/sys/dev/ofw/openfirm.c ============================================================================== --- head/sys/dev/ofw/openfirm.c Mon Mar 30 09:29:45 2015 (r280847) +++ head/sys/dev/ofw/openfirm.c Mon Mar 30 09:49:54 2015 (r280848) @@ -154,16 +154,16 @@ xrefinfo_init(void *unsed) SYSINIT(xrefinfo, SI_SUB_KMEM, SI_ORDER_ANY, xrefinfo_init, NULL); static struct xrefinfo * -xrefinfo_find(phandle_t phandle, int find_by) +xrefinfo_find(uintptr_t key, int find_by) { struct xrefinfo *rv, *xi; rv = NULL; mtx_lock(&xreflist_lock); SLIST_FOREACH(xi, &xreflist, next_entry) { - if ((find_by == FIND_BY_XREF && phandle == xi->xref) || - (find_by == FIND_BY_NODE && phandle == xi->node) || - (find_by == FIND_BY_DEV && phandle == (uintptr_t)xi->dev)) { + if ((find_by == FIND_BY_XREF && (phandle_t)key == xi->xref) || + (find_by == FIND_BY_NODE && (phandle_t)key == xi->node) || + (find_by == FIND_BY_DEV && key == (uintptr_t)xi->dev)) { rv = xi; break; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201503300949.t2U9ntL9091425>