iwlwifi: dbg_ini: Split memcpy() to avoid multi-field write
Bugzilla: https://bugzilla.redhat.com/2059999 commit cb0a1fb7fd86b0062692b5056ca8552906509512 Author: Kees Cook <keescook@chromium.org> Date: Tue Jul 27 13:58:54 2021 -0700 iwlwifi: dbg_ini: Split memcpy() to avoid multi-field write To avoid a run-time false positive in the stricter FORTIFY_SOURCE memcpy() checks, split the memcpy() into the struct and the data. Additionally switch the data member to a flexible array to follow modern language conventions. Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20210727205855.411487-64-keescook@chromium.org Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
This commit is contained in:
parent
70527aa85a
commit
fd85569079
|
@ -119,7 +119,7 @@ enum iwl_ucode_tlv_type {
|
|||
struct iwl_ucode_tlv {
|
||||
__le32 type; /* see above */
|
||||
__le32 length; /* not including type/length fields */
|
||||
u8 data[0];
|
||||
u8 data[];
|
||||
};
|
||||
|
||||
#define IWL_TLV_UCODE_MAGIC 0x0a4c5749
|
||||
|
|
|
@ -74,7 +74,8 @@ static int iwl_dbg_tlv_add(const struct iwl_ucode_tlv *tlv,
|
|||
if (!node)
|
||||
return -ENOMEM;
|
||||
|
||||
memcpy(&node->tlv, tlv, sizeof(node->tlv) + len);
|
||||
memcpy(&node->tlv, tlv, sizeof(node->tlv));
|
||||
memcpy(node->tlv.data, tlv->data, len);
|
||||
list_add_tail(&node->list, list);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue