From: Hanjun Guo <hanjun.guo@linaro.org>
To: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
linux-acpi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Sinan Kaya <okaya@codeaurora.org>,
Tomasz Nowicki <tn@semihalf.com>,
Nate Watterson <nwatters@codeaurora.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH] ACPI/IORT: Fix iort_node_get_id() mapping entries indexing
Date: Mon, 9 Jan 2017 16:01:09 +0800 [thread overview]
Message-ID: <ca7a81e0-e1ba-9205-d443-534b9520bac2@linaro.org> (raw)
In-Reply-To: <20170105182921.8167-1-lorenzo.pieralisi@arm.com>
On 2017/1/6 2:29, Lorenzo Pieralisi wrote:
> Commit 618f535a6062 ("ACPI/IORT: Add single mapping function")
> introduced a function (iort_node_get_id()) to retrieve ids for IORT
> named components.
>
> iort_node_get_id() takes an index as input to refer to a specific
> mapping entry in the mapping array to retrieve the id at a specific
> index provided the index is below the total mapping count; currently the
> index is used to retrieve the mapping value from the correct entry but
> not to dereference the correct entry while retrieving the mapping
> output_reference (ie IORT parent pointer), which consequently always
> resolves to the output_reference of the first entry in the mapping
> array.
>
> Update the map array entry pointer computation in iort_node_get_id() to
> take into account the index value, fixing the issue.
>
> Fixes: 618f535a6062 ("ACPI/IORT: Add single mapping function")
> Reported-by: Hanjun Guo <hanjun.guo@linaro.org>
> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Hanjun Guo <hanjun.guo@linaro.org>
> Cc: Sinan Kaya <okaya@codeaurora.org>
> Cc: Tomasz Nowicki <tn@semihalf.com>
> Cc: Nate Watterson <nwatters@codeaurora.org>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> ---
> drivers/acpi/arm64/iort.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index e0d2e6e..ba156c5 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c
> @@ -333,7 +333,7 @@ struct acpi_iort_node *iort_node_get_id(struct acpi_iort_node *node,
> return NULL;
>
> map = ACPI_ADD_PTR(struct acpi_iort_id_mapping, node,
> - node->mapping_offset);
> + node->mapping_offset + index * sizeof(*map));
>
> /* Firmware bug! */
> if (!map->output_reference) {
> @@ -348,10 +348,10 @@ struct acpi_iort_node *iort_node_get_id(struct acpi_iort_node *node,
> if (!(IORT_TYPE_MASK(parent->type) & type_mask))
> return NULL;
>
> - if (map[index].flags & ACPI_IORT_ID_SINGLE_MAPPING) {
> + if (map->flags & ACPI_IORT_ID_SINGLE_MAPPING) {
> if (node->type == ACPI_IORT_NODE_NAMED_COMPONENT ||
> node->type == ACPI_IORT_NODE_PCI_ROOT_COMPLEX) {
> - *id_out = map[index].output_base;
> + *id_out = map->output_base;
> return parent;
> }
> }
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
prev parent reply other threads:[~2017-01-09 8:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-05 18:29 Lorenzo Pieralisi
2017-01-05 18:37 ` Sinan Kaya
2017-01-06 9:48 ` Lorenzo Pieralisi
2017-01-07 21:09 ` Sinan Kaya
2017-01-09 6:34 ` Hanjun Guo
2017-01-09 6:48 ` Hanjun Guo
2017-01-09 11:20 ` okaya
2017-01-09 8:01 ` Hanjun Guo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ca7a81e0-e1ba-9205-d443-534b9520bac2@linaro.org \
--to=hanjun.guo@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=nwatters@codeaurora.org \
--cc=okaya@codeaurora.org \
--cc=rjw@rjwysocki.net \
--cc=tn@semihalf.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®