From c0be4107606c4aeb41fb238a5ef31339b27e5da0 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sat, 21 Mar 2020 18:52:14 +0100 Subject: drivers/intel/gma/acpi: Use snprintf() to construct device name TEST=Booted ThinkPad X201s, backlight control still works. Change-Id: Ieee02f698879ba6b60d863dd63ef9107c0d502b5 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/coreboot/+/39728 Reviewed-by: HAOUAS Elyes Reviewed-by: Patrick Georgi Reviewed-by: Matt DeVillier Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/drivers/intel/gma/acpi.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/drivers/intel/gma') diff --git a/src/drivers/intel/gma/acpi.c b/src/drivers/intel/gma/acpi.c index ff4372f610..3ec8527e6f 100644 --- a/src/drivers/intel/gma/acpi.c +++ b/src/drivers/intel/gma/acpi.c @@ -50,8 +50,7 @@ drivers_intel_gma_displays_ssdt_generate(const struct i915_gpu_controller_info * acpigen_pop_len(); /* End Method. */ for (i = 0; i < conf->ndid; i++) { - char name[10]; - char *ptr; + char name[5]; int kind; kind = (conf->did[i] >> 8) & 0xf; @@ -59,10 +58,7 @@ drivers_intel_gma_displays_ssdt_generate(const struct i915_gpu_controller_info * kind = 0; } - strcpy(name, names[kind]); - for (ptr = name; *ptr; ptr++); - *ptr++ = counters[kind] + '0'; - *ptr++ = '\0'; + snprintf(name, sizeof(name), "%s%d", names[kind], counters[kind]); counters[kind]++; /* Device (LCD0) */ -- cgit v1.2.3