Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1392766pxb; Wed, 10 Feb 2021 07:26:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyjVmxH403FDfIXyH22qzxSU+8kU9RKrUujrss0/2escqibpCZnLtIoAhj6EFNq+69CIVc6 X-Received: by 2002:a17:907:1191:: with SMTP id uz17mr3460025ejb.371.1612970774298; Wed, 10 Feb 2021 07:26:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612970774; cv=none; d=google.com; s=arc-20160816; b=SYIz3B8Myf161B5HEoBU/caoNR+vN+tgyU/gy9EQfQFuvxHB0WyqAfy2fZNLXo23IC /9dPuMAHRd0S5h6RwrkA0LY459DG6bWFV+oxtqvt/I3wOy843yLWLalzyiMM92eqKrGr VTUZsnObWywYnIQCmMUV28m+6EJRhwh5Cq4vRTfwYag9QeclFV/fk7oB90RGoKtlwMON wksauZwwblh4ucsl9mNIzvLPbWQu0Dl7B0lkDQdzztf9Ktmf/f9y6Q/vQTNVWcXNJ8FP tGxy9SWyJvbNSWW/w1HyLzP+hicBNEslnUgOowIM3ZV2Ul9OYFM1QZadk5KzDJCjEuHT E1ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from; bh=wEjsWD4tqccp6SzD7+uEP68ZbcEHE4AnYyyekW+7Jys=; b=QeqjaRXpS1XLaJbuS4rgVNyUZrTnygXJHXmIZcgzMLVmeBmzdnNIjKDj6Xg7RgGJ8K OWW0JDYxA1++RtfFXOH4sPMr/Kr1LgPaJvXsXIZSRJH9en1+Z2ey33mDReSUJEUxblai 1ChbKKOTwm+HqBv7AGL2bXHiuSjN0U2cCIrrl530xh/DaudowP87lazbUahagnCdOwwy 3cz2kAnDvQKKZlu7G5lu38LFDsZNwT0Z7ChGFv8v6f/WTaDtEBXST5CrYhkZVU6hO2EJ 8iutdjSflR1dWP37eW/MKI3Nmb1LiPEatxizkESBKR+vr8OEQttPBkN6H9qgmPa3wscZ kreA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k27si1313481eje.568.2021.02.10.07.25.50; Wed, 10 Feb 2021 07:26:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231926AbhBJPZE (ORCPT + 99 others); Wed, 10 Feb 2021 10:25:04 -0500 Received: from paleale.coelho.fi ([176.9.41.70]:45360 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231708AbhBJPYy (ORCPT ); Wed, 10 Feb 2021 10:24:54 -0500 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=redipa.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1l9rLT-0049nr-EG; Wed, 10 Feb 2021 17:23:59 +0200 From: Luca Coelho To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org Date: Wed, 10 Feb 2021 17:23:52 +0200 Message-Id: X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210210152355.419776-1-luca@coelho.fi> References: <20210210152355.419776-1-luca@coelho.fi> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on farmhouse.coelho.fi X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, TVD_RCVD_IP autolearn=ham autolearn_force=no version=3.4.4 Subject: [PATCH 5/8] iwlwifi: pnvm: increment the pointer before checking the TLV Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Luca Coelho 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 Fixes: 6972592850c0 ("iwlwifi: read and parse PNVM file") Signed-off-by: Luca Coelho --- 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