summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJamie Ryu <jamie.m.ryu@intel.com>2023-06-08 10:41:11 -0700
committerEric Lai <eric_lai@quanta.corp-partner.google.com>2023-06-14 07:33:13 +0000
commit6c0961ae43243ecb7544de83bef3ba9480ca6bbb (patch)
tree0c5e4673ec028dd80080441145b5a8626637fe5e
parentb6f45efd641212ed0633d50a2d61260b0411a46b (diff)
downloadcoreboot-6c0961ae43243ecb7544de83bef3ba9480ca6bbb.tar.gz
coreboot-6c0961ae43243ecb7544de83bef3ba9480ca6bbb.tar.bz2
coreboot-6c0961ae43243ecb7544de83bef3ba9480ca6bbb.zip
drivers/wwan/fm: Fix format string vulnerability with snprintf
This fixes format string vulnerability issues with snprintf statement found by klocwork scan. Foundby=klocwork BUG=NONE TEST=Boot to OS on Meteor Lake rex platform and run klocwork scan. Check related ACPI tables and modem driver behavior after changes. Signed-off-by: Jamie Ryu <jamie.m.ryu@intel.com> Change-Id: Ia6b7d70c0b2b86d0918e58348dccd206a7ee9193 Reviewed-on: https://review.coreboot.org/c/coreboot/+/75733 Reviewed-by: Kapil Porwal <kapilporwal@google.com> Reviewed-by: Subrata Banik <subratabanik@google.com> Reviewed-by: Cliff Huang <cliff.huang@intel.com> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/drivers/wwan/fm/acpi_fm350gl.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/drivers/wwan/fm/acpi_fm350gl.c b/src/drivers/wwan/fm/acpi_fm350gl.c
index 46f8ecb9af0f..139fd15047ec 100644
--- a/src/drivers/wwan/fm/acpi_fm350gl.c
+++ b/src/drivers/wwan/fm/acpi_fm350gl.c
@@ -62,8 +62,8 @@ static void wwan_fm350gl_acpi_method_fhrf(const struct device *parent_dev,
rtd3_config = config_of(config->rtd3dev);
if (rtd3_config->use_rp_mutex) {
- snprintf(mutex_path, sizeof(mutex_path), acpi_device_path_join(parent_dev,
- RP_MUTEX_NAME));
+ snprintf(mutex_path, sizeof(mutex_path), "%s",
+ acpi_device_path_join(parent_dev, RP_MUTEX_NAME));
/* Acquire root port mutex in case FHRF is called directly and not called from _RST */
acpigen_write_acquire(mutex_path, ACPI_MUTEX_NO_TIMEOUT);
}
@@ -129,8 +129,8 @@ static void wwan_fm350gl_acpi_method_shrf(const struct device *parent_dev,
rtd3_config = config_of(config->rtd3dev);
if (rtd3_config->use_rp_mutex) {
- snprintf(mutex_path, sizeof(mutex_path), acpi_device_path_join(parent_dev,
- RP_MUTEX_NAME));
+ snprintf(mutex_path, sizeof(mutex_path), "%s",
+ acpi_device_path_join(parent_dev, RP_MUTEX_NAME));
/* Acquire root port mutex */
acpigen_write_acquire(mutex_path, ACPI_MUTEX_NO_TIMEOUT);
}
@@ -184,8 +184,8 @@ static void wwan_fm350gl_acpi_method_rst(const struct device *parent_dev,
rtd3_config = config_of(config->rtd3dev);
if (rtd3_config->use_rp_mutex) {
- snprintf(mutex_path, sizeof(mutex_path), acpi_device_path_join(parent_dev,
- RP_MUTEX_NAME));
+ snprintf(mutex_path, sizeof(mutex_path), "%s",
+ acpi_device_path_join(parent_dev, RP_MUTEX_NAME));
/* Acquire root port mutex */
acpigen_write_acquire(mutex_path, ACPI_MUTEX_NO_TIMEOUT);
}
@@ -219,8 +219,8 @@ static void wwan_fm350gl_acpi_method_mrst_rst(const struct device *parent_dev,
rtd3_config = config_of(config->rtd3dev);
if (rtd3_config->use_rp_mutex) {
- snprintf(mutex_path, sizeof(mutex_path), acpi_device_path_join(parent_dev,
- RP_MUTEX_NAME));
+ snprintf(mutex_path, sizeof(mutex_path), "%s",
+ acpi_device_path_join(parent_dev, RP_MUTEX_NAME));
/* Acquire root port mutex */
acpigen_write_acquire(mutex_path, ACPI_MUTEX_NO_TIMEOUT);
}