platform/x86: dell-ddv: Improve buffer handling
authorArmin Wolf <W_Armin@gmx.de>
Wed, 2 Nov 2022 21:23:35 +0000 (22:23 +0100)
committerHans de Goede <hdegoede@redhat.com>
Wed, 16 Nov 2022 07:48:19 +0000 (08:48 +0100)
commit84fa20c2a56a9d941fef68dd2c1d489a5f24daa7
treea33cf8ed613e300a043894b989d7c4c7071f70e4
parent93b962ddd69a11c956e40b26e494132c514608a9
platform/x86: dell-ddv: Improve buffer handling

When the DDV interface returns a buffer, it actually
returns a acpi buffer containing an integer (buffer size)
and another acpi buffer (buffer content).
The size of the buffer may be smaller than the size of
the buffer content, which is perfectly valid and should not
be treated as an error.
Also use the buffer size instead of the buffer content size
when accessing the buffer to prevent accessing bogus data.

Tested on a Dell Inspiron 3505.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20221102212336.380257-1-W_Armin@gmx.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/dell/dell-wmi-ddv.c