From: Rui Miguel Silva Date: Thu, 27 Feb 2025 09:45:49 +0000 (+0000) Subject: mach-snapdragon: of_fixup: fix property length at writing X-Git-Tag: v2025.07-rc2~44^2~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1542c090ee0081abbb126c31f9a12cb3afe86ad8;p=thirdparty%2Fu-boot.git mach-snapdragon: of_fixup: fix property length at writing The length of a property includes '\0' in a string type one, so the length passed by needs to have that in account, if not, when getting the property value it will fail because it has the wrong size. Signed-off-by: Rui Miguel Silva Tested-by: caleb.connolly@linaro.org # db845c Reviewed-by: Caleb Connolly Reviewed-by: Neil Armstrong Link: https://lore.kernel.org/r/20250227094911.497219-2-rui.silva@linaro.org Signed-off-by: Caleb Connolly --- diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c index 55368dd43b6..ea956a4791d 100644 --- a/arch/arm/mach-snapdragon/of_fixup.c +++ b/arch/arm/mach-snapdragon/of_fixup.c @@ -86,13 +86,13 @@ static int fixup_qcom_dwc3(struct device_node *glue_np) } /* Overwrite "phy-names" to only contain a single entry */ - ret = of_write_prop(dwc3, "phy-names", strlen("usb2-phy"), "usb2-phy"); + ret = of_write_prop(dwc3, "phy-names", strlen("usb2-phy") + 1, "usb2-phy"); if (ret) { log_err("Failed to overwrite 'phy-names' property: %d\n", ret); return ret; } - ret = of_write_prop(dwc3, "maximum-speed", strlen("high-speed"), "high-speed"); + ret = of_write_prop(dwc3, "maximum-speed", strlen("high-speed") + 1, "high-speed"); if (ret) { log_err("Failed to set 'maximum-speed' property: %d\n", ret); return ret;