From owner-svn-src-head@FreeBSD.ORG Mon Mar 30 09:49:55 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 806EF37A; Mon, 30 Mar 2015 09:49:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C7D12D8; Mon, 30 Mar 2015 09:49:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2U9ntQJ091426; Mon, 30 Mar 2015 09:49:55 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2U9ntL9091425; Mon, 30 Mar 2015 09:49:55 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201503300949.t2U9ntL9091425@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Mon, 30 Mar 2015 09:49:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280848 - head/sys/dev/ofw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Mar 2015 09:49:55 -0000 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 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; }