* [PATCH v2 01/16] wifi: iwlwifi: fw: increase fw_version string size
@ 2023-10-12 12:41 gregory.greenman
2023-10-12 15:59 ` Kalle Valo
0 siblings, 1 reply; 2+ messages in thread
From: gregory.greenman @ 2023-10-12 12:41 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless, Gregory Greenman
From: Gregory Greenman <gregory.greenman@intel.com>
In reality 64 bytes are enough to hold fw version string,
but some compilers can complain (with W=1) that output may be
truncated when building this string with snprintf.
Increase the size to avoid this sort of warnings and state
explicitely that we want the size to be trancated to 32 bytes.
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
---
v2: explicitely limit size to 32 bytes in several snprintf() calls.
---
drivers/net/wireless/intel/iwlwifi/dvm/main.c | 2 +-
drivers/net/wireless/intel/iwlwifi/fw/img.h | 4 ++--
drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/main.c b/drivers/net/wireless/intel/iwlwifi/dvm/main.c
index a873be109f43..8774dd7b921e 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/main.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/main.c
@@ -1464,7 +1464,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
snprintf(priv->hw->wiphy->fw_version,
sizeof(priv->hw->wiphy->fw_version),
- "%s", fw->fw_version);
+ "%.31s", fw->fw_version);
priv->new_scan_threshold_behaviour =
!!(ucode_flags & IWL_UCODE_TLV_FLAGS_NEWSCAN);
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/img.h b/drivers/net/wireless/intel/iwlwifi/fw/img.h
index 8d0d58d61892..96bda80632f3 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/img.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/img.h
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/*
- * Copyright (C) 2005-2014, 2018-2021 Intel Corporation
+ * Copyright (C) 2005-2014, 2018-2023 Intel Corporation
* Copyright (C) 2013-2015 Intel Mobile Communications GmbH
* Copyright (C) 2016 Intel Deutschland GmbH
*/
@@ -198,7 +198,7 @@ struct iwl_dump_exclude {
struct iwl_fw {
u32 ucode_ver;
- char fw_version[64];
+ char fw_version[128];
/* ucode images */
struct fw_img img[IWL_UCODE_TYPE_MAX];
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 465090f67aaf..4390adc31a29 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -1304,7 +1304,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
snprintf(mvm->hw->wiphy->fw_version,
sizeof(mvm->hw->wiphy->fw_version),
- "%s", fw->fw_version);
+ "%.31s", fw->fw_version);
trans_cfg.fw_reset_handshake = fw_has_capa(&mvm->fw->ucode_capa,
IWL_UCODE_TLV_CAPA_FW_RESET_HANDSHAKE);
--
2.38.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 01/16] wifi: iwlwifi: fw: increase fw_version string size
2023-10-12 12:41 [PATCH v2 01/16] wifi: iwlwifi: fw: increase fw_version string size gregory.greenman
@ 2023-10-12 15:59 ` Kalle Valo
0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2023-10-12 15:59 UTC (permalink / raw)
To: gregory.greenman; +Cc: johannes, linux-wireless
gregory.greenman@intel.com writes:
> From: Gregory Greenman <gregory.greenman@intel.com>
>
> In reality 64 bytes are enough to hold fw version string,
> but some compilers can complain (with W=1) that output may be
> truncated when building this string with snprintf.
> Increase the size to avoid this sort of warnings and state
> explicitely that we want the size to be trancated to 32 bytes.
>
> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Thanks, I don't see warnings from iwlwifi anymore.
Tested-by: Kalle Valo <kvalo@kernel.org>
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-12 15:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-12 12:41 [PATCH v2 01/16] wifi: iwlwifi: fw: increase fw_version string size gregory.greenman
2023-10-12 15:59 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).