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>
This commit is contained in:
Jamie Ryu 2023-06-08 10:41:11 -07:00 committed by Eric Lai
parent b6f45efd64
commit 6c0961ae43
1 changed files with 8 additions and 8 deletions

View File

@ -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);
}