From owner-freebsd-bugs@freebsd.org Thu Nov 9 23:50:32 2017 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3656E5F964 for ; Thu, 9 Nov 2017 23:50:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (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 A1A117DFC4 for ; Thu, 9 Nov 2017 23:50:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id vA9NoVmp057911 for ; Thu, 9 Nov 2017 23:50:32 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 223519] __BUS_ACCESSOR doesn't check return value of BUS_READ_IVAR Date: Thu, 09 Nov 2017 23:50:32 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: jhb@FreeBSD.org X-Bugzilla-Status: Closed X-Bugzilla-Resolution: Works As Intended X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status resolution Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 23:50:32 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D223519 John Baldwin changed: What |Removed |Added ---------------------------------------------------------------------------- Status|New |Closed Resolution|--- |Works As Intended --- Comment #1 from John Baldwin --- Unfortunately, this is inherent in the design of __BUS_ACCESSOR. There is = no universal value to return to indicate an invalid ivar (e.g. ivars can have a value of -1). In essence, the assumption is that _BUS_ACCESSOR is a convenience wrapper for ivars that are always valid. One should use BUS_READ_IVAR() directly if one wishes to handle possibly invalid ivars. The ACPI ivars accessors use a different macro that returns a default value= of 0 so that acpi_get_handle() will "fail" properly, but that is only ok for A= CPI. I think it would perhaps be useful to extend the ACPI model slightly to hav= e a __BUS_ACCESSOR_DEFAULT() that accepts an additional "default value" paramet= er which is returned if BUS_READ_IVAR fails perhaps? That could replace the A= CPI macro and be useful for other cases since on an individual ivar you might be able to return a suitable value for error. In general with ivars I have wanted a way to name them by a tuple (group, index) (ACPI just starts indices at 100 to get around this) and then have a= way to say "do you have this group". This would let you ask a given device "do= you have PCI ivars" (i.e. are you a PCI device). However, this would require restructuring ivars a bit. That wouldn't help with your bug where a single ivar out of a group was not properly implemented either. --=20 You are receiving this mail because: You are the assignee for the bug.=