From: Jiang Liu <jiang.liu@linux.intel.com>
To: Simone Gotti <simone.gotti@gmail.com>, linux-pci@vger.kernel.org
Cc: linux-acpi@vger.kernel.org, Narendra_K@Dell.com
Subject: Re: [PATCH 1/1] ACPI / PCI: Fix "Operation not permitted" error reading sysfs acpi_index and label files.
Date: Thu, 19 Jun 2014 00:22:55 +0800 [thread overview]
Message-ID: <53A1BCDF.8080402@linux.intel.com> (raw)
In-Reply-To: <1403103330-17874-1-git-send-email-simone.gotti@gmail.com>
Hi Simone,
Thanks for fixing this, you may add
Reviewed-by: Jiang Liu <jiang.liu@linux.intel.com>
On 2014/6/18 22:55, Simone Gotti wrote:
> If the _DSM method returns an unicode string then the acpi type is not
> ACPI_TYPE_STRING but ACPI_TYPE_BUFFER.
>
> Before commit 1d0fcef732832432aee47cb75bf4a2cb3107be64 the dsm_get_label
> function wasn't checking the second element type and it was correctly working only with
> ACPI_TYPE_BUFFER as the call to dsm_label_utf16s_to_utf8s will return bad
> encoding for an ascii string.
>
> Also fix dsm_label_utf16s_to_utf8s to use acpi_object->buffer instead of
> acpi_object->string.
>
> This fixes changed onboard interfaces names generated by udev net_id internal as
> reading from the acpi_index file returned "Operation not permitted" error.
>
> Signed-off-by: Simone Gotti <simone.gotti@gmail.com>
> ---
> drivers/pci/pci-label.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
> index a3fbe20..2ab1b47 100644
> --- a/drivers/pci/pci-label.c
> +++ b/drivers/pci/pci-label.c
> @@ -161,8 +161,8 @@ enum acpi_attr_enum {
> static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf)
> {
> int len;
> - len = utf16s_to_utf8s((const wchar_t *)obj->string.pointer,
> - obj->string.length,
> + len = utf16s_to_utf8s((const wchar_t *)obj->buffer.pointer,
> + obj->buffer.length,
> UTF16_LITTLE_ENDIAN,
> buf, PAGE_SIZE);
> buf[len] = '\n';
> @@ -187,16 +187,22 @@ static int dsm_get_label(struct device *dev, char *buf,
> tmp = obj->package.elements;
> if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2 &&
> tmp[0].type == ACPI_TYPE_INTEGER &&
> - tmp[1].type == ACPI_TYPE_STRING) {
> + (tmp[1].type == ACPI_TYPE_STRING ||
> + tmp[1].type == ACPI_TYPE_BUFFER)) {
> /*
> * The second string element is optional even when
> * this _DSM is implemented; when not implemented,
> * this entry must return a null string.
> */
> - if (attr == ACPI_ATTR_INDEX_SHOW)
> + if (attr == ACPI_ATTR_INDEX_SHOW) {
> scnprintf(buf, PAGE_SIZE, "%llu\n", tmp->integer.value);
> - else if (attr == ACPI_ATTR_LABEL_SHOW)
> - dsm_label_utf16s_to_utf8s(tmp + 1, buf);
> + } else if (attr == ACPI_ATTR_LABEL_SHOW) {
> + if (tmp[1].type == ACPI_TYPE_STRING)
> + scnprintf(buf, PAGE_SIZE, "%s\n",
> + tmp[1].string.pointer);
> + else if (tmp[1].type == ACPI_TYPE_BUFFER)
> + dsm_label_utf16s_to_utf8s(tmp + 1, buf);
> + }
> len = strlen(buf) > 0 ? strlen(buf) : -1;
> }
>
>
next prev parent reply other threads:[~2014-06-18 16:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 14:51 [PATCH 0/1] ACPI / PCI: Fix "Operation not permitted" error reading sysfs acpi_index and label files Simone Gotti
2014-06-18 14:55 ` [PATCH 1/1] " Simone Gotti
2014-06-18 16:22 ` Jiang Liu [this message]
2014-07-02 22:19 ` Bjorn Helgaas
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=53A1BCDF.8080402@linux.intel.com \
--to=jiang.liu@linux.intel.com \
--cc=Narendra_K@Dell.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=simone.gotti@gmail.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;
as well as URLs for NNTP newsgroup(s).