[PATCH 18/18] common: Use signed return value for ieee802_11_defrag_mle_subelem

Benjamin Berg benjamin at sipsolutions.net
Thu Oct 30 01:24:49 PDT 2025


From: Benjamin Berg <benjamin.berg at intel.com>

The function returns -1 on error which is not a valid value for size_t.
Fix this by returning ssize_t.

Fixes: 88f7d4cedfea ("Helper function for defragmenting of Multi-Link element subelements")
CC: Pooventhiran G <quic_pooventh at quicinc.com>
Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
---
 src/common/ieee802_11_common.c | 6 +++---
 src/common/ieee802_11_common.h | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index 82a4c1f734..6d190614b1 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -3478,9 +3478,9 @@ struct wpabuf * ieee802_11_defrag(const u8 *data, size_t len, bool ext_elem)
  * of data, see IEEE P802.11be/D7.0 Figure 35-4 - Per-STA Profile subelement
  * fragmentation within a fragmented Multi-Link element.
  */
-size_t ieee802_11_defrag_mle_subelem(struct wpabuf *mlbuf,
-				     const u8 *parent_subelem,
-				     size_t *defrag_len)
+ssize_t ieee802_11_defrag_mle_subelem(struct wpabuf *mlbuf,
+				      const u8 *parent_subelem,
+				      size_t *defrag_len)
 {
 	u8 *buf, *pos, *end;
 	size_t len, subelem_len;
diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h
index 906c138546..21caccce45 100644
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -382,9 +382,9 @@ int ieee802_edmg_is_allowed(struct ieee80211_edmg_config allowed,
 			    struct ieee80211_edmg_config requested);
 
 struct wpabuf * ieee802_11_defrag(const u8 *data, size_t len, bool ext_elem);
-size_t ieee802_11_defrag_mle_subelem(struct wpabuf *mlbuf,
-				     const u8 *parent_subelem,
-				     size_t *defrag_len);
+ssize_t ieee802_11_defrag_mle_subelem(struct wpabuf *mlbuf,
+				      const u8 *parent_subelem,
+				      size_t *defrag_len);
 const u8 * get_ml_ie(const u8 *ies, size_t len, u8 type);
 const u8 * get_basic_mle_mld_addr(const u8 *buf, size_t len);
 
-- 
2.51.0




More information about the Hostap mailing list