This is a note to let you know that I've just added the patch titled platform/chrome: chromeos_acpi: print hex string for ACPI_TYPE_BUFFER to the 6.5-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: platform-chrome-chromeos_acpi-print-hex-string-for-acpi_type_buffer.patch and it can be found in the queue-6.5 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 0820debb7d489e9eb1f68b7bb69e6ae210699b3f Mon Sep 17 00:00:00 2001 From: Tzung-Bi Shih <tzungbi@xxxxxxxxxx> Date: Thu, 3 Aug 2023 09:12:45 +0800 Subject: platform/chrome: chromeos_acpi: print hex string for ACPI_TYPE_BUFFER From: Tzung-Bi Shih <tzungbi@xxxxxxxxxx> commit 0820debb7d489e9eb1f68b7bb69e6ae210699b3f upstream. `element->buffer.pointer` should be binary blob. `%s` doesn't work perfect for them. Print hex string for ACPI_TYPE_BUFFER. Also update the documentation to reflect this. Fixes: 0a4cad9c11ad ("platform/chrome: Add ChromeOS ACPI device driver") Cc: stable@xxxxxxxxxxxxxxx Reviewed-by: Guenter Roeck <linux@xxxxxxxxxxxx> Link: https://lore.kernel.org/r/20230803011245.3773756-1-tzungbi@xxxxxxxxxx Signed-off-by: Tzung-Bi Shih <tzungbi@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- Documentation/ABI/testing/sysfs-driver-chromeos-acpi | 2 - drivers/platform/chrome/chromeos_acpi.c | 31 ++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) --- a/Documentation/ABI/testing/sysfs-driver-chromeos-acpi +++ b/Documentation/ABI/testing/sysfs-driver-chromeos-acpi @@ -134,4 +134,4 @@ KernelVersion: 5.19 Description: Returns the verified boot data block shared between the firmware verification step and the kernel verification step - (binary). + (hex dump). --- a/drivers/platform/chrome/chromeos_acpi.c +++ b/drivers/platform/chrome/chromeos_acpi.c @@ -90,7 +90,36 @@ static int chromeos_acpi_handle_package( case ACPI_TYPE_STRING: return sysfs_emit(buf, "%s\n", element->string.pointer); case ACPI_TYPE_BUFFER: - return sysfs_emit(buf, "%s\n", element->buffer.pointer); + { + int i, r, at, room_left; + const int byte_per_line = 16; + + at = 0; + room_left = PAGE_SIZE - 1; + for (i = 0; i < element->buffer.length && room_left; i += byte_per_line) { + r = hex_dump_to_buffer(element->buffer.pointer + i, + element->buffer.length - i, + byte_per_line, 1, buf + at, room_left, + false); + if (r > room_left) + goto truncating; + at += r; + room_left -= r; + + r = sysfs_emit_at(buf, at, "\n"); + if (!r) + goto truncating; + at += r; + room_left -= r; + } + + buf[at] = 0; + return at; +truncating: + dev_info_once(dev, "truncating sysfs content for %s\n", name); + sysfs_emit_at(buf, PAGE_SIZE - 4, "..\n"); + return PAGE_SIZE - 1; + } default: dev_err(dev, "element type %d not supported\n", element->type); return -EINVAL; Patches currently in stable-queue which might be from tzungbi@xxxxxxxxxx are queue-6.5/platform-chrome-chromeos_acpi-print-hex-string-for-acpi_type_buffer.patch