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 2C7FA45CD8 for ; Mon, 18 Nov 2024 19:22:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 808F1432CA; Mon, 18 Nov 2024 19:22:28 +0100 (CET) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by mails.dpdk.org (Postfix) with ESMTP id 5FD0842D2B for ; Mon, 18 Nov 2024 19:22:17 +0100 (CET) Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2ea1c455d0eso2293442a91.2 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=dLBxPy+RudSKWe0WZkUHcuk16S0f8v0OqSrBBkkqFnv5DQKfOyDEw9e4uloeBLLDa0 ZAQr9umBgd4aB3RD3LGuAZVCBZJ8gMA7F/v4TrQ6zgooSyMMDGcLLfuhEAlfeo1E5JbR pHnN15sQnGvZlZF5qa7dUbZ3NeqDPwWo2InNTbXESYLx7wWeicnJU2rgd9Ah6+6YWH+8 Xh3jJTeCEombNZwq2ibj20ZCV/MxmrzVePcFYYzPxQgTCtCuAUbfGxp4EGbHlA5SRqiW E9IhmN7hGuSuKX8K8kNRB+/fPPwKFYQ4QH5euL7kcEJCEEuWUxEirSAxDKNaEdO/sgGz 464g== X-Forwarded-Encrypted: i=1; AJvYcCXcswArbYjLn0UeDTS2XFmTnPafhUuXm+AlXBEN+tfI4eHTQ4buYgfVHpqHuDXsJqToGagJ6Ow=@dpdk.org X-Gm-Message-State: AOJu0Yx/NyF+59qg0CtNM8N+5TyTiwVyUJFHd3kl3/BMKFnqEIzwpqcj 1V6smHrCBy5vZ/XdX4pppbAc22S1wkhcV2pr8SJmEQz+klXyjB54im9kZ6qC8/c= 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: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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