Skip to content

Commit 45c720c

Browse files
lucacoelhogregkh
authored andcommitted
iwlwifi: pnvm: increment the pointer before checking the TLV
[ Upstream commit ff11a8e ] If the SKU_ID doesn't match, we don't increment the pointer and keep checking the same TLV over and over again. We need to increment the pointer in all situtations, namely if the TLV is not a SKU_ID, if the SKU_ID matched or if the SKU_ID didn't match. So we can increment the pointer already before checking for these conditions to solve the problem. Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Fixes: 6972592 ("iwlwifi: read and parse PNVM file") Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20210210172142.de94d366f3ff.I9a5a54906cf0f4ec8af981d6066bfd771152ffb9@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 4770889 commit 45c720c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • drivers/net/wireless/intel/iwlwifi/fw

drivers/net/wireless/intel/iwlwifi/fw/pnvm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ static int iwl_pnvm_parse(struct iwl_trans *trans, const u8 *data,
198198
le32_to_cpu(sku_id->data[1]),
199199
le32_to_cpu(sku_id->data[2]));
200200

201+
data += sizeof(*tlv) + ALIGN(tlv_len, 4);
202+
len -= ALIGN(tlv_len, 4);
203+
201204
if (trans->sku_id[0] == le32_to_cpu(sku_id->data[0]) &&
202205
trans->sku_id[1] == le32_to_cpu(sku_id->data[1]) &&
203206
trans->sku_id[2] == le32_to_cpu(sku_id->data[2])) {
204207
int ret;
205208

206-
data += sizeof(*tlv) + ALIGN(tlv_len, 4);
207-
len -= ALIGN(tlv_len, 4);
208-
209209
ret = iwl_pnvm_handle_section(trans, data, len);
210210
if (!ret)
211211
return 0;

0 commit comments

Comments
 (0)