From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 9722845D0B;
	Fri, 15 Nov 2024 07:08:51 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 8FF2642FC5;
	Fri, 15 Nov 2024 07:08:04 +0100 (CET)
Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com
 [209.85.210.181])
 by mails.dpdk.org (Postfix) with ESMTP id 8B75842F9D
 for <dev@dpdk.org>; Fri, 15 Nov 2024 07:07:59 +0100 (CET)
Received: by mail-pf1-f181.google.com with SMTP id
 d2e1a72fcca58-71e592d7f6eso1016883b3a.3
 for <dev@dpdk.org>; Thu, 14 Nov 2024 22:07:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731650879;
 x=1732255679; 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=F8L0Sbp7CmbMo7pZMh5Sb9k5o2mNt+kbwIL7cwBlPOc=;
 b=h2yLbrmHFqqNfBqSugArqks++q8pU+/0fvb1Fi3D9YIUYWSGnvRlab+hs8l85Rdob+
 //kElOSrLpe/Jbby5tDJlrhNl6bJO/Q6E/mCZ4TLuv4VsiLqkND0OiYzAtSGDwvkubcb
 vX/Dp/Xkf+ynV8vVNjm6kWorTNs9I1CT99bfNHE8Yd2gJ3x0clcewJcoPjsF2C+OU2Ah
 hwGbPTRTb0Rcl7GLwdFlUY5LhnylC6DrPd9kSPFLnFCxCPP8Ei0RZkLAmvR3p+ldc2br
 ZxnmrgIp4l95Nj/pwIutuOK5KVlMPvpLV7FRPLj22CDpvtPwzpZaOAIlC4eDyQJ+y+Ds
 XINA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1731650879; x=1732255679;
 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=F8L0Sbp7CmbMo7pZMh5Sb9k5o2mNt+kbwIL7cwBlPOc=;
 b=kHq5WnS7IAW4E/A2CfjSHA23eakzdZ34sEuLp1SH2JE4TrupxzexdWYdFfRj9/FZDw
 r8A3ZpUMt7AgklgFHbdwCqgKUb6A0MkOnImXiOP/YKqcHTIM6A/namil/bvmyJiBIdcp
 4AvGRJKoXFzTd/RlebrgVlOu/uenTWkSO6zIiZ3Vc10NptxOd157WMU2w2pYrhmzLq6R
 5iIG/obXaofVM4dXKYzMzoBENuDZMRGC18s4DFpHIaA1d4hx794OZ4lCMIp7rQVlOfL+
 UGGfShrPVHkXzIglDKt7kdKG5B+6KgvWwFl08fGZlJusgJlaWMEgVivG057f8ZLqJZJQ
 ovLQ==
X-Gm-Message-State: AOJu0YxJoUloC4ummOiWizmpelXuEqw5qv55kkmDNrzL+HkLFt6MKH6V
 zxA31/z51/Ds8Xzqn/yn5jrv3TDV+dhm9tGVGuR5auJrBXFKJUF2UeiD9r7ndBoLmlf5PvfXUML
 Q
X-Google-Smtp-Source: AGHT+IG1YFKbr4dGGjMZTrSgQ6BrDO+TPxqEDG+bppVen9CiWljGrR29Cl6NQ7pcPZkioOkR1bcXYQ==
X-Received: by 2002:a05:6a21:a105:b0:1db:eb51:bac5 with SMTP id
 adf61e73a8af0-1dc90bb39e1mr2035847637.31.1731650878316; 
 Thu, 14 Nov 2024 22:07:58 -0800 (PST)
Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226])
 by smtp.gmail.com with ESMTPSA id
 98e67ed59e1d1-2ea06f4856esm2123781a91.23.2024.11.14.22.07.57
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 14 Nov 2024 22:07:57 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
 danielx.t.mrzyglod@intel.com, stable@dpdk.org,
 Kirill Rybalchenko <kirill.rybalchenko@intel.com>,
 John McNamara <john.mcnamara@intel.com>,
 Pablo de Lara <pablo.de.lara.guarch@intel.com>
Subject: [PATCH 09/16] examples/ptpclient: fix self memcmp
Date: Thu, 14 Nov 2024 22:05:46 -0800
Message-ID: <20241115060738.313190-10-stephen@networkplumber.org>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20241115060738.313190-1-stephen@networkplumber.org>
References: <20241115060738.313190-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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Calling memcmp on same structure will always be true.
Replace with same conditional used elsewhere.

Link: https://pvs-studio.com/en/blog/posts/cpp/1183/

Fixes: ab129e9065a5 ("examples/ptpclient: add minimal PTP client")
Cc: danielx.t.mrzyglod@intel.com
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/ptpclient/ptpclient.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index 2ec532d058..d6dff2eb7e 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -419,7 +419,7 @@ parse_sync(struct ptpv2_time_receiver_ordinary *ptp_data, uint16_t rx_tstamp_idx
 		ptp_data->ptpset = 1;
 	}
 
-	if (memcmp(&ptp_hdr->source_port_id.clock_id,
+	if (memcmp(&ptp_data->transmitter_clock_id,
 			&ptp_hdr->source_port_id.clock_id,
 			sizeof(struct clock_id)) == 0) {
 
-- 
2.45.2