Commit 1722c83f authored by Johannes Berg's avatar Johannes Berg

wifi: iwlwifi: dbg-tlv: use struct_size() for allocation

This is effectively the same since we don't even have a
multiplication, but better captures what happens with
the length.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Reviewed-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240128084842.f301641eb916.I66b7b48a526377d682eecef874373bf3a01076c8@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 2f72c759
...@@ -71,7 +71,7 @@ static struct iwl_ucode_tlv *iwl_dbg_tlv_add(const struct iwl_ucode_tlv *tlv, ...@@ -71,7 +71,7 @@ static struct iwl_ucode_tlv *iwl_dbg_tlv_add(const struct iwl_ucode_tlv *tlv,
u32 len = le32_to_cpu(tlv->length); u32 len = le32_to_cpu(tlv->length);
struct iwl_dbg_tlv_node *node; struct iwl_dbg_tlv_node *node;
node = kzalloc(sizeof(*node) + len, GFP_KERNEL); node = kzalloc(struct_size(node, tlv.data, len), GFP_KERNEL);
if (!node) if (!node)
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment