From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 78BD445CD8; Mon, 18 Nov 2024 19:23:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 77D1B432C0; Mon, 18 Nov 2024 19:22:27 +0100 (CET) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by mails.dpdk.org (Postfix) with ESMTP id 5B0184281D for ; Mon, 18 Nov 2024 19:22:17 +0100 (CET) Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-7f8b37edeb7so3425614a12.0 for ; Mon, 18 Nov 2024 10:22:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731954136; x=1732558936; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0aq0m7CJiYEhfdg3sFJZ4X+X4CGzqNiEKFarpoevP/A=; b=A8De03yKI6DCujhkyPbCj+i+pD1rihOtVF5dAMLGuHm2lrWoDaD+ldgjBgBa0smFem acb3Em+Q3mW1UpT3BeaKE2jSwBjjRIYj6XqMZThHBYkFBkjmAcQBs8Je4BW4tdTQHbah jykGHkJdQHTbd7hQK4bgt0GCcmr4/XW6n9fEMmWdM5c4vIRdrmNtbhZ3VYxpeZnfkVtq WnyBOtvvJ3jJGDA0/oBuLyoTYR3LXPB30mRNC9R3HbhgLNd3HCfi82cD2wIE9CDfBLqr nMycYpNPMZukfuHX46vdyRD0mnxpwOgm5BZzzrtBe+RQ9RW1UYPqt5RadLRDq9At9Y6w NfCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731954136; x=1732558936; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0aq0m7CJiYEhfdg3sFJZ4X+X4CGzqNiEKFarpoevP/A=; b=rErkSDC5jKzvv+Y4U8DkqAr+EAuWBXRRqRY7c7GEtVOGibkgLselmDbrbyLMRtJnTR 8+0hjO1fHqoQVCKkuUbJdP1nieUBBYUiGax/wJUrRC4QaYnl288ki+YHWuA1VGm9Vbae 4y3T3I/fnBTA6lZ9mMVPhDrjy2DLQPPzBpCgP/WsbmwW+UiPpXD84pnLJWtc+aoF4cfm YdWvddEEeKh0nWbcfu8w+9TS3MjqgQdvH4Mtfm+jn7J2zbM84Uk7GKJg4oL4hJxA1pWK UoI7RydTqpVNKqFnbjL6oLdyqmtw01LYfb5dHSYt8XU5vrCnc/RbDc045xvwdYQeYXk7 ypyQ== X-Gm-Message-State: AOJu0YwR8EEC+txwdJyhVixDFAkIJsn3TFsV9+ZNlDQ/m1FKPgK8ZH/z 6o0yRH03OO0aB57tiBQpE+wMzkHaVfW42Uih/drq2qqOc0W1L0cpF/jLJfS+of7q4HlUQA9iL9o Q X-Google-Smtp-Source: AGHT+IFDnXcmGHniVp5TH+ll7PQiVvfFhqroSw0kZR+tb8alR6hCOup8i+ulqZ8MdbmOIJ6PV/Pjjw== X-Received: by 2002:a17:90b:3ecd:b0:2ea:7d8f:6f17 with SMTP id 98e67ed59e1d1-2ea7d8f8821mr5232429a91.10.1731954136659; Mon, 18 Nov 2024 10:22:16 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ea61869bb2sm2916724a91.12.2024.11.18.10.22.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 10:22:16 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , rasesh.mody@cavium.com, stable@dpdk.org Subject: [PATCH v2 17/19] net/qede: don't use same loop variable twice Date: Mon, 18 Nov 2024 10:20:58 -0800 Message-ID: <20241118182153.87042-18-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118182153.87042-1-stephen@networkplumber.org> References: <20241115060738.313190-1-stephen@networkplumber.org> <20241118182153.87042-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Using variable in outer loop, and inner loop is obvious bug. This bug is in base code, so likely on other platforms as well. Link: https://pvs-studio.com/en/blog/posts/cpp/1183/ Fixes: 81dba2b2ff61 ("net/qede/base: add LLDP support") Cc: rasesh.mody@cavium.com Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger --- drivers/net/qede/base/ecore_dcbx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/qede/base/ecore_dcbx.c b/drivers/net/qede/base/ecore_dcbx.c index 31234f18cf..72bbedd65a 100644 --- a/drivers/net/qede/base/ecore_dcbx.c +++ b/drivers/net/qede/base/ecore_dcbx.c @@ -1363,7 +1363,7 @@ ecore_lldp_mib_update_event(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt) struct ecore_dcbx_mib_meta_data data; enum _ecore_status_t rc = ECORE_SUCCESS; struct lldp_received_tlvs_s tlvs; - int i; + int i, j; for (i = 0; i < LLDP_MAX_LLDP_AGENTS; i++) { OSAL_MEM_ZERO(&data, sizeof(data)); @@ -1381,9 +1381,9 @@ ecore_lldp_mib_update_event(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt) if (!tlvs.length) continue; - for (i = 0; i < MAX_TLV_BUFFER; i++) - tlvs.tlvs_buffer[i] = - OSAL_CPU_TO_BE32(tlvs.tlvs_buffer[i]); + for (j = 0; j < MAX_TLV_BUFFER; j++) + tlvs.tlvs_buffer[j] = + OSAL_CPU_TO_BE32(tlvs.tlvs_buffer[j]); OSAL_LLDP_RX_TLVS(p_hwfn, tlvs.tlvs_buffer, tlvs.length); } -- 2.45.2