All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 5/8] iwlwifi: pnvm: increment the pointer before checking the TLV
Date: Wed, 10 Feb 2021 17:23:52 +0200	[thread overview]
Message-ID: <iwlwifi.20210210172142.de94d366f3ff.I9a5a54906cf0f4ec8af981d6066bfd771152ffb9@changeid> (raw)
In-Reply-To: <20210210152355.419776-1-luca@coelho.fi>

From: Luca Coelho <luciano.coelho@intel.com>

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: 6972592850c0 ("iwlwifi: read and parse PNVM file")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/fw/pnvm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c b/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c
index 1e16f83b402b..37ce4fe136c5 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c
@@ -198,14 +198,14 @@ static int iwl_pnvm_parse(struct iwl_trans *trans, const u8 *data,
 				     le32_to_cpu(sku_id->data[1]),
 				     le32_to_cpu(sku_id->data[2]));
 
+			data += sizeof(*tlv) + ALIGN(tlv_len, 4);
+			len -= ALIGN(tlv_len, 4);
+
 			if (trans->sku_id[0] == le32_to_cpu(sku_id->data[0]) &&
 			    trans->sku_id[1] == le32_to_cpu(sku_id->data[1]) &&
 			    trans->sku_id[2] == le32_to_cpu(sku_id->data[2])) {
 				int ret;
 
-				data += sizeof(*tlv) + ALIGN(tlv_len, 4);
-				len -= ALIGN(tlv_len, 4);
-
 				ret = iwl_pnvm_handle_section(trans, data, len);
 				if (!ret)
 					return 0;
-- 
2.30.0


  parent reply	other threads:[~2021-02-10 15:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 15:23 [PATCH 0/8] iwlwifi: updates intended for v5.12 2021-02-10 part 2 Luca Coelho
2021-02-10 15:23 ` [PATCH 1/8] iwlwifi: mvm: reduce the print severity of failing getting NIC temp Luca Coelho
2021-02-10 23:57   ` Luca Coelho
2021-02-10 15:23 ` [PATCH 2/8] iwlwifi: mvm: global PM mode does not reset after FW crash Luca Coelho
2021-02-10 15:23 ` [PATCH 3/8] iwlwifi: pnvm: set the PNVM again if it was already loaded Luca Coelho
2021-02-10 15:23 ` [PATCH 4/8] iwlwifi: pcie: define FW_RESET_TIMEOUT for clarity Luca Coelho
2021-02-10 15:23 ` Luca Coelho [this message]
2021-02-10 15:23 ` [PATCH 6/8] iwlwifi: pnvm: move file loading code to a separate function Luca Coelho
2021-02-10 15:23 ` [PATCH 7/8] iwlwifi: pnvm: implement reading PNVM from UEFI Luca Coelho
2021-02-10 18:01   ` kernel test robot
2021-02-10 18:01     ` kernel test robot
2021-02-10 15:23 ` [PATCH 8/8] iwlwifi: bump FW API to 62 for AX devices Luca Coelho
2021-02-10 23:58   ` Luca Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=iwlwifi.20210210172142.de94d366f3ff.I9a5a54906cf0f4ec8af981d6066bfd771152ffb9@changeid \
    --to=luca@coelho.fi \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.