* [BUG] PVH ACPI XSDT table construction
@ 2020-05-26 17:13 Daniel Smith
2020-05-26 17:57 ` Roger Pau Monné
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Smith @ 2020-05-26 17:13 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]
Greetings,
I was reviewing the ACPI construction for PVH and discovered what I believe is a flaw in the logic for selecting the XSDT tables. The current logic is,
static bool __init pvh_acpi_xsdt_table_allowed(const char *sig,
unsigned long address,
unsigned long size)
{
/*
* DSDT and FACS are pointed to from FADT and thus don't belong
* in XSDT.
*/
return (pvh_acpi_table_allowed(sig, address, size) &&
strncmp(sig, ACPI_SIG_DSDT, ACPI_NAME_SIZE) &&
strncmp(sig, ACPI_SIG_FACS, ACPI_NAME_SIZE));
}
Unless I am mistaken, the boolean logic in the return statement will always return false resulting in an empty XSDT table. I believe based on the comment what was intended here was,
return (pvh_acpi_table_allowed(sig, address, size) &&
!(strncmp(sig, ACPI_SIG_DSDT, ACPI_NAME_SIZE) ||
strncmp(sig, ACPI_SIG_FACS, ACPI_NAME_SIZE)));
Thanks!
V/r,
Daniel P. Smith
Apertus Solutions, LLC
[-- Attachment #2: Type: text/html, Size: 2553 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUG] PVH ACPI XSDT table construction
2020-05-26 17:13 [BUG] PVH ACPI XSDT table construction Daniel Smith
@ 2020-05-26 17:57 ` Roger Pau Monné
2020-05-26 18:08 ` Daniel P. Smith
0 siblings, 1 reply; 3+ messages in thread
From: Roger Pau Monné @ 2020-05-26 17:57 UTC (permalink / raw)
To: Daniel Smith; +Cc: xen-devel
On Tue, May 26, 2020 at 01:13:19PM -0400, Daniel Smith wrote:
> Greetings,
>
>
>
> I was reviewing the ACPI construction for PVH and discovered what I believe is a flaw in the logic for selecting the XSDT tables. The current logic is,
>
>
>
> static bool __init pvh_acpi_xsdt_table_allowed(const char *sig,
>
> unsigned long address,
>
> unsigned long size)
>
> {
>
> /*
>
> * DSDT and FACS are pointed to from FADT and thus don't belong
>
> * in XSDT.
>
> */
>
> return (pvh_acpi_table_allowed(sig, address, size) &&
>
> strncmp(sig, ACPI_SIG_DSDT, ACPI_NAME_SIZE) &&
>
> strncmp(sig, ACPI_SIG_FACS, ACPI_NAME_SIZE));
>
> }
>
>
>
> Unless I am mistaken, the boolean logic in the return statement will always return false resulting in an empty XSDT table. I believe based on the comment what was intended here was,
>
>
>
> return (pvh_acpi_table_allowed(sig, address, size) &&
>
> !(strncmp(sig, ACPI_SIG_DSDT, ACPI_NAME_SIZE) ||
>
> strncmp(sig, ACPI_SIG_FACS, ACPI_NAME_SIZE)));
Keep in mind that strncmp will return 0 if the signature matches, and
hence doing this won't allow any table, as it would require a
signature to match both the DSDT and the FACS one (you would require
strncmp to return 0 in both cases).
The code is correct AFAICT, as it won't add DSDT or FACS to the XSDT
(because strncmp will return 0 in that case).
Roger.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUG] PVH ACPI XSDT table construction
2020-05-26 17:57 ` Roger Pau Monné
@ 2020-05-26 18:08 ` Daniel P. Smith
0 siblings, 0 replies; 3+ messages in thread
From: Daniel P. Smith @ 2020-05-26 18:08 UTC (permalink / raw)
To: xen-devel
On 5/26/20 1:57 PM, Roger Pau Monné wrote:
>
> Keep in mind that strncmp will return 0 if the signature matches, and
> hence doing this won't allow any table, as it would require a
> signature to match both the DSDT and the FACS one (you would require
> strncmp to return 0 in both cases).
>
> The code is correct AFAICT, as it won't add DSDT or FACS to the XSDT
> (because strncmp will return 0 in that case).
>
> Roger.
>
Ugh, your are right. Apologies for the noise.
V/r,
DPS
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-26 18:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 17:13 [BUG] PVH ACPI XSDT table construction Daniel Smith
2020-05-26 17:57 ` Roger Pau Monné
2020-05-26 18:08 ` Daniel P. Smith
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.