[PATCH] ACPI: Battery: Fix incorrect fallthrough in extract_package()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix incorrect fallthrough behavior in the ACPI_TYPE_BUFFER case of
extract_package().

The current code processes ACPI_TYPE_BUFFER data and then falls through
to also process it as ACPI_TYPE_STRING data, which is incorrect. The
buffer case should copy the buffer data and then break, not fall through
to the string handling code. This ensures that buffer and string types
are handled correctly and independently in the switch statement.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@xxxxxxxxx>
---
 drivers/acpi/battery.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 6905b56bf3e4..18fc5d828e70 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -445,8 +445,9 @@ static int extract_package(struct acpi_battery *battery,
 			case ACPI_TYPE_BUFFER:
 				if (len > element->buffer.length + 1)
 					len = element->buffer.length + 1;
+				strscpy(ptr, element->buffer.pointer, len);
 
-				fallthrough;
+				break;
 			case ACPI_TYPE_STRING:
 				strscpy(ptr, element->string.pointer, len);
 
-- 
2.34.1





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux