From owner-freebsd-current@FreeBSD.ORG Mon Feb 14 18:59:02 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 9AD38106564A; Mon, 14 Feb 2011 18:59:01 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: John Baldwin Date: Mon, 14 Feb 2011 13:58:44 -0500 User-Agent: KMail/1.6.2 References: <201102141330.20330.jkim@FreeBSD.org> <201102141337.59203.jhb@freebsd.org> In-Reply-To: <201102141337.59203.jhb@freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201102141358.45583.jkim@FreeBSD.org> Cc: freebsd-current@freebsd.org, Matthew Fleming Subject: Re: acpi_resource bug? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Feb 2011 18:59:02 -0000 On Monday 14 February 2011 01:37 pm, John Baldwin wrote: > On Monday, February 14, 2011 1:30:18 pm Jung-uk Kim wrote: > > On Monday 14 February 2011 10:29 am, Matthew Fleming wrote: > > > On Mon, Feb 14, 2011 at 6:24 AM, John Baldwin > > > > wrote: > > > > On Sunday, February 13, 2011 2:46:07 pm Matthew Fleming wrote: > > > >> I'm not very familiar with the acpi code, but we have seen > > > >> an intermittent issue on boot: > > > >> > > > >> 1) should the length of the bcopy() be changed to either > > > >> respect res->Length or the actual length of the > > > >> ACPI_RESOURCE_DATA for the type? > > > > > > > > It should just use res->Length: > > > > > > Is there a guarantee that res->Length is <= > > > sizeof(ACPI_RESOURCE) ? > > > > No. Please try the attached patch (after your r218685). > > I think your patch is correct, but are you saying that ACPICA will > return a resource with a size that doesn't match its type? > > ACPI_RESOURCE_DATA is a union of all the various resource types, > and it does contain both ACPI_RESOURCE_IRQ and > ACPI_RESOURCE_EXTENDED_IRQ, so it's hard to see how res->Length > would be greater than the size of ACPI_RESOURCE. Some resource type has variable size. For example, ACPI_RESOURCE_EXTENDED_IRQ has ACPI_RESOURCE_SOURCE field, which has a pointer to string and Length field will include length of the string (+ 1 for null terminator). Also, the Length only includes the ACPI_RESOURCE_DATA, not the header itself, etc. Jung-uk Kim