From: Hans de Goede <hdegoede@redhat.com>
To: Armin Wolf <W_Armin@gmx.de>, markgross@kernel.org
Cc: jdelvare@suse.com, linux@roeck-us.net,
platform-driver-x86@vger.kernel.org, linux-hwmon@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] platform/x86: dell-ddv: Return error if buffer is empty
Date: Mon, 30 Jan 2023 16:05:53 +0100 [thread overview]
Message-ID: <94ae8042-89f7-9210-1bda-a22dd9fe7d4d@redhat.com> (raw)
In-Reply-To: <20230126194021.381092-3-W_Armin@gmx.de>
Hi,
On 1/26/23 20:40, Armin Wolf wrote:
> In several cases, the DDV WMI interface can return buffers
> with a length of zero. Return -ENODATA in such a case for
> proper error handling. Also replace some -EIO errors with
> more specialized ones.
>
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Thank you for your patch, I've applied this patch to my review-hans
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
> ---
> drivers/platform/x86/dell/dell-wmi-ddv.c | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/platform/x86/dell/dell-wmi-ddv.c b/drivers/platform/x86/dell/dell-wmi-ddv.c
> index 9cb6ae42dbdc..f99c4cb686fd 100644
> --- a/drivers/platform/x86/dell/dell-wmi-ddv.c
> +++ b/drivers/platform/x86/dell/dell-wmi-ddv.c
> @@ -11,6 +11,7 @@
> #include <linux/debugfs.h>
> #include <linux/device.h>
> #include <linux/dev_printk.h>
> +#include <linux/errno.h>
> #include <linux/kernel.h>
> #include <linux/kstrtox.h>
> #include <linux/math.h>
> @@ -125,21 +126,27 @@ static int dell_wmi_ddv_query_buffer(struct wmi_device *wdev, enum dell_ddv_meth
> if (ret < 0)
> return ret;
>
> - if (obj->package.count != 2)
> - goto err_free;
> + if (obj->package.count != 2 ||
> + obj->package.elements[0].type != ACPI_TYPE_INTEGER ||
> + obj->package.elements[1].type != ACPI_TYPE_BUFFER) {
> + ret = -ENOMSG;
>
> - if (obj->package.elements[0].type != ACPI_TYPE_INTEGER)
> goto err_free;
> + }
>
> buffer_size = obj->package.elements[0].integer.value;
>
> - if (obj->package.elements[1].type != ACPI_TYPE_BUFFER)
> + if (!buffer_size) {
> + ret = -ENODATA;
> +
> goto err_free;
> + }
>
> if (buffer_size > obj->package.elements[1].buffer.length) {
> dev_warn(&wdev->dev,
> FW_WARN "WMI buffer size (%llu) exceeds ACPI buffer size (%d)\n",
> buffer_size, obj->package.elements[1].buffer.length);
> + ret = -EMSGSIZE;
>
> goto err_free;
> }
> @@ -151,7 +158,7 @@ static int dell_wmi_ddv_query_buffer(struct wmi_device *wdev, enum dell_ddv_meth
> err_free:
> kfree(obj);
>
> - return -EIO;
> + return ret;
> }
>
> static int dell_wmi_ddv_query_string(struct wmi_device *wdev, enum dell_ddv_method method,
> --
> 2.30.2
>
next prev parent reply other threads:[~2023-01-30 15:06 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-26 19:40 [PATCH 0/5] platform/x86: dell-ddv: Various driver updates Armin Wolf
2023-01-26 19:40 ` [PATCH 1/5] platform/x86: dell-ddv: Add support for interface version 3 Armin Wolf
2023-01-30 15:05 ` Hans de Goede
2023-01-26 19:40 ` [PATCH 2/5] platform/x86: dell-ddv: Return error if buffer is empty Armin Wolf
2023-01-30 15:05 ` Hans de Goede [this message]
2023-01-26 19:40 ` [PATCH 3/5] platform/x86: dell-ddv: Replace EIO with ENOMSG Armin Wolf
2023-01-30 15:06 ` Hans de Goede
2023-01-26 19:40 ` [PATCH 4/5] platform/x86: dell-ddv: Add "force" module param Armin Wolf
2023-01-30 15:06 ` Hans de Goede
2023-01-30 15:09 ` Hans de Goede
2023-01-30 15:11 ` Hans de Goede
2023-01-26 19:40 ` [PATCH 5/5] platform/x86: dell-ddv: Add hwmon support Armin Wolf
2023-01-27 13:08 ` Guenter Roeck
2023-01-27 16:09 ` Armin Wolf
2023-02-02 21:12 ` Armin Wolf
2023-02-02 21:29 ` Hans de Goede
2023-02-03 1:07 ` Armin Wolf
2023-02-03 7:49 ` Hans de Goede
2023-01-29 9:47 ` kernel test robot
2023-01-30 15:30 ` Hans de Goede
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=94ae8042-89f7-9210-1bda-a22dd9fe7d4d@redhat.com \
--to=hdegoede@redhat.com \
--cc=W_Armin@gmx.de \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/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