3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-30 06:02:39 +01:00

ie: Allow building an empty IE sequence in ie_tlv_builder_finalize

Since we use the special 0xffff value in the builder code, check that
the tag is not 0xffff in ie_tlv_builder_finalize before writing the
header.  This is for consistency, not for a specific use case.
This commit is contained in:
Andrew Zaborowski 2017-09-22 05:06:27 +02:00 committed by Denis Kenzior
parent 5d8cb6260f
commit 025d8dad44

View File

@ -330,11 +330,14 @@ bool ie_tlv_builder_recurse(struct ie_tlv_builder *builder,
void ie_tlv_builder_finalize(struct ie_tlv_builder *builder,
unsigned int *out_len)
{
unsigned int len;
unsigned int len = 0;
ie_tlv_builder_write_header(builder);
if (builder->tag != 0xffff) {
ie_tlv_builder_write_header(builder);
len = builder->pos + TLV_HEADER_LEN + builder->tlv[builder->pos + 1];
len = builder->pos + TLV_HEADER_LEN +
builder->tlv[builder->pos + 1];
}
if (out_len)
*out_len = len;