On Thu, 2021-05-27 at 20:16 +0000, Krzysztof Wilczyński wrote: > Modify the function dsm_label_utf16s_to_utf8s() to directly return the > number of bytes written into the buffer so that the strlen() used later > to calculate the length of the buffer can be removed as it would no > longer be needed. [] > diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c [] > @@ -139,14 +139,17 @@ enum acpi_attr_enum { > ACPI_ATTR_INDEX_SHOW, > }; > > > -static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf) > +static int dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf) > { > int len; > + > len = utf16s_to_utf8s((const wchar_t *)obj->buffer.pointer, > obj->buffer.length, > UTF16_LITTLE_ENDIAN, > buf, PAGE_SIZE); This should be PAGE_SIZE - 1 no? > buf[len] = '\n'; > + > + return len; return len + 1 ?