From: Krzysztof Kozlowski <krzk@kernel.org>
To: Ally Heev <allyheev@gmail.com>,
Miri Korenblit <miriam.rachel.korenblit@intel.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH iwlwifi-next v4] wifi: iwlwifi: fix uninitialized pointers with free attribute
Date: Sat, 22 Nov 2025 15:20:02 +0100 [thread overview]
Message-ID: <3ef371f6-c296-44d8-87d7-477d6a97dabb@kernel.org> (raw)
In-Reply-To: <20251121-aheev-uninitialized-free-attr-wireless-v4-1-75239da589ef@gmail.com>
On 21/11/2025 15:25, Ally Heev wrote:
> Uninitialized pointers with `__free` attribute can cause undefined
> behavior as the memory assigned randomly to the pointer is freed
> automatically when the pointer goes out of scope.
>
> It is better to initialize and assign pointers with `__free` attribute
> in one statement to ensure proper scope-based cleanup
>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/all/aPiG_F5EBQUjZqsl@stanley.mountain/
> Signed-off-by: Ally Heev <allyheev@gmail.com>
> ---
> Changes in v4:
> - moved pointers declaration to where the allocation is
> - Link to v3: https://lore.kernel.org/r/20251111-aheev-uninitialized-free-attr-wireless-v3-1-26e889d0e7ee@gmail.com
>
> Changes in v3:
> - fixed commit message to include iwlwifi
> - reverted unused variable removal. To be done in a different patch
> - Link to v2: https://lore.kernel.org/r/20251107-aheev-uninitialized-free-attr-wireless-v2-1-674fc3e5c78e@gmail.com
>
> Changes in v2:
> - fixed style issues
> - ignore v1 of this patch
> - Link to v1: https://lore.kernel.org/r/20251105-aheev-uninitialized-free-attr-wireless-v1-1-6c850a4a952a@gmail.com
> ---
> drivers/net/wireless/intel/iwlwifi/fw/uefi.c | 2 +-
> drivers/net/wireless/intel/iwlwifi/mld/d3.c | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/intel/iwlwifi/fw/uefi.c b/drivers/net/wireless/intel/iwlwifi/fw/uefi.c
> index 4ae4d215e633e0d51194d818d479349e7c502201..2fe5f744a81cf42e768cc409f1af8823e204946f 100644
> --- a/drivers/net/wireless/intel/iwlwifi/fw/uefi.c
> +++ b/drivers/net/wireless/intel/iwlwifi/fw/uefi.c
> @@ -818,9 +818,9 @@ int iwl_uefi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value)
>
> int iwl_uefi_get_phy_filters(struct iwl_fw_runtime *fwrt)
> {
> - struct uefi_cnv_wpfc_data *data __free(kfree);
> struct iwl_phy_specific_cfg *filters = &fwrt->phy_filters;
>
> + struct uefi_cnv_wpfc_data *data __free(kfree) = NULL;
> data = iwl_uefi_get_verified_variable(fwrt->trans, IWL_UEFI_WPFC_NAME,
This should be one line. Please do not split declaration from
constructors. If maintainers do not like that syntax, then they should
not allow to use cleanup.h in their subsystem.
> Best regards,
Best regards,
Krzysztof
prev parent reply other threads:[~2025-11-22 14:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-21 14:25 Ally Heev
2025-11-22 14:20 ` Krzysztof Kozlowski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3ef371f6-c296-44d8-87d7-477d6a97dabb@kernel.org \
--to=krzk@kernel.org \
--cc=allyheev@gmail.com \
--cc=dan.carpenter@linaro.org \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=miriam.rachel.korenblit@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®