All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 1/6] dpp: don't allocate transient ssid strings
@ 2022-01-10 16:59 Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2022-01-10 16:59 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 302 bytes --]

Hi James,

On 1/7/22 18:13, James Prestwood wrote:
> These can be kept on the stack and avoid the need for
> allocated memory and unneeded auto-free functionality.
> ---
>   src/dpp.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 

All applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH v2 1/6] dpp: don't allocate transient ssid strings
@ 2022-01-08  0:13 James Prestwood
  0 siblings, 0 replies; 2+ messages in thread
From: James Prestwood @ 2022-01-08  0:13 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]

These can be kept on the stack and avoid the need for
allocated memory and unneeded auto-free functionality.
---
 src/dpp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/dpp.c b/src/dpp.c
index 20c27a57..61c6b36d 100644
--- a/src/dpp.c
+++ b/src/dpp.c
@@ -400,7 +400,7 @@ static void send_config_result(struct dpp_sm *dpp, const uint8_t *to)
 static void dpp_write_config(struct dpp_configuration *config,
 				struct network *network)
 {
-	_auto_(l_free) char *ssid = l_malloc(config->ssid_len + 1);
+	char ssid[33];
 	_auto_(l_settings_free) struct l_settings *settings = l_settings_new();
 	_auto_(l_free) char *path;
 	_auto_(l_free) uint8_t *psk = NULL;
@@ -494,7 +494,7 @@ static void dpp_handle_config_response_frame(const struct mmpdu_header *frame,
 	struct station *station = station_find(netdev_get_ifindex(dpp->netdev));
 	struct network *network;
 	struct scan_bss *bss = NULL;
-	_auto_(l_free) char *ssid = NULL;
+	char ssid[33];
 
 	if (dpp->state != DPP_STATE_CONFIGURING)
 		return;
@@ -618,7 +618,6 @@ static void dpp_handle_config_response_frame(const struct mmpdu_header *frame,
 		return;
 	}
 
-	ssid = l_malloc(config->ssid_len + 1);
 	memcpy(ssid, config->ssid, config->ssid_len);
 	ssid[config->ssid_len] = '\0';
 
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-10 16:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10 16:59 [PATCH v2 1/6] dpp: don't allocate transient ssid strings Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2022-01-08  0:13 James Prestwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.