Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2231401ybl; Sun, 18 Aug 2019 21:38:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyTCDrvRfKwG1CJLh8f0HGV2YuokKtMJW9+N9XJeglMFM/FKcyWc3FuWdT4TOn9wTok7IQA X-Received: by 2002:aa7:8201:: with SMTP id k1mr21736226pfi.97.1566189484399; Sun, 18 Aug 2019 21:38:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566189484; cv=none; d=google.com; s=arc-20160816; b=bXxozRrybLhFnsBRRw8n/uNGBryhr+37NA+aVa5ZHxcoqzzwjgtHf7M9aeycyP3PLS DqGHTTbHy2WTuWGhsG09ORNq0q2YIGQTy1Bs48TWja6DLsDXql1dh9lu//vzl6OwkmzN AYnzeX9GtzzrGDrzA6enDVD7mtm+ZUqRB8EMW3fEgCVLU8mFdKOGxLSf6b1li98JNfhL 3XMDCamm9hjFr8eb7jno7T2FcjExPAK5On/+YGribQp7JLuRV3N1pQlGxUpD9cL4fsDi 3WXVszOeFAH3I1yBYL+/8j/qurZ5OuqvgExcCeRJEsbDd6jtu/Nqolvu61j9KJZGkeSV 1Kuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ZUCw4jAs77fJWvJ1Lbk9AJyiu5YLLMkfP4oKtMz1NVw=; b=sId+Jwf8Q4kqFe56+tCcwgax3FYXQKztQyRxaBioI51sEDJaRLNbJbfhIKfYN9QkwZ fTIUa5aMrPtpME04bMOhNYMzuGASpkk46KY2O+Ly/Tr0OBDQQZsA+WrKW6H1FgqeSn1P 7wz4Ht0C0DG1KxF18ju2zQmdL+RpBMIxyYsb93CiqKMFGByCrI6V+TPnrfMonZsnF9qA wJFUYajXwt+kB38BktpsXHNXQVJxQtdK6fUXLAWPsYsHtXnIOU0ARSIyHFp7ortqPSYk vQXDNVX1ypJxwfGKS7yRXHTje2zAC8zAlJce8fUcSuyWXIFPQlVDwoaFKCNFeYC9j8Mw W3LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uYH4KbWl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r16si8969948pgv.466.2019.08.18.21.37.49; Sun, 18 Aug 2019 21:38:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uYH4KbWl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726415AbfHSEhA (ORCPT + 99 others); Mon, 19 Aug 2019 00:37:00 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35782 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725536AbfHSEhA (ORCPT ); Mon, 19 Aug 2019 00:37:00 -0400 Received: by mail-wr1-f68.google.com with SMTP id k2so7193008wrq.2; Sun, 18 Aug 2019 21:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZUCw4jAs77fJWvJ1Lbk9AJyiu5YLLMkfP4oKtMz1NVw=; b=uYH4KbWl08ZgKEpjhyYlfwvt9PdrFvpKMSKrDB/bHWMyRU+XUtYSStUbBLT5ziwZGl t60r3tqUrSES+VTAuxKq3qBMi3tLrQQNaL0SIigL/02DNaxLMfCrVhVHJ211ZyUXZ2CQ auHG0As1cCwaTCqHlXIhGDIYQWlDA7UERd0CKQTsAQUNqEnPjlbwK2klFMq2mJshC6Qj EBIpU7+XyUzC5g/mNOtUuxvLD/JQM5MPi0R2nfcrpj8ak8j6MXSLzEMQqVf154qbaI3Q XtxeoHtsJPy7cv8bhx/BVrTiyu9jgeKD7IcKIy0KruGZZm/p3HQSrvz3cJG2aFSc+Umi 7Mfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZUCw4jAs77fJWvJ1Lbk9AJyiu5YLLMkfP4oKtMz1NVw=; b=bWkDL8CL579GUqvVxFdcPOeEvD8g/9YTNR5FFATA0/4DgtD8zCZbux/xOwpzxHRMId P2N2fS7vZzMf6u614sHqfNvW53bWt7kEKglX+0yMw+c4DYFu7kr9WMHubG0tfvzUswN2 n+t1chn3iVHAbeaGEQqt7sNi2sjhdTAEf4ej0RUgZ3IBOvtjMjvh6IcBh1qvXlFLDcNi awFlUNvLkmJUTNZawGqDr8XmPM86eMhrneTv6qeYEq1AyuJ+eX/PuTScrqzH7qOMfu7g hG3c7UfKbHo2eO9HBRUsCGxLrIjXOhdBmoY37RXMzRIw+jvs3eAfoyxLv6u10+8u3bqd oXZQ== X-Gm-Message-State: APjAAAUBkgeTWcun9KOpTKvGWz1WFsG5mK6f/ohAFvRFOhUh3/4C9r72 Ej8sCDxpqIUZexBWrSqx/dY= X-Received: by 2002:adf:de02:: with SMTP id b2mr24526170wrm.204.1566189417661; Sun, 18 Aug 2019 21:36:57 -0700 (PDT) Received: from localhost.localdomain ([2a01:4f8:222:2f1b::2]) by smtp.gmail.com with ESMTPSA id j10sm15218526wrd.26.2019.08.18.21.36.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Aug 2019 21:36:56 -0700 (PDT) From: Nathan Chancellor To: Alexei Starovoitov , Daniel Borkmann Cc: Martin KaFai Lau , Song Liu , Yonghong Song , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor Subject: [PATCH] test_bpf: Fix a new clang warning about xor-ing two numbers Date: Sun, 18 Aug 2019 21:34:20 -0700 Message-Id: <20190819043419.68223-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org r369217 in clang added a new warning about potential misuse of the xor operator as an exponentiation operator: ../lib/test_bpf.c:870:13: warning: result of '10 ^ 300' is 294; did you mean '1e300'? [-Wxor-used-as-pow] { { 4, 10 ^ 300 }, { 20, 10 ^ 300 } }, ~~~^~~~~ 1e300 ../lib/test_bpf.c:870:13: note: replace expression with '0xA ^ 300' to silence this warning ../lib/test_bpf.c:870:31: warning: result of '10 ^ 300' is 294; did you mean '1e300'? [-Wxor-used-as-pow] { { 4, 10 ^ 300 }, { 20, 10 ^ 300 } }, ~~~^~~~~ 1e300 ../lib/test_bpf.c:870:31: note: replace expression with '0xA ^ 300' to silence this warning The commit link for this new warning has some good logic behind wanting to add it but this instance appears to be a false positive. Adopt its suggestion to silence the warning but not change the code. According to the differential review link in the clang commit, GCC may eventually adopt this warning as well. Link: https://github.com/ClangBuiltLinux/linux/issues/643 Link: https://github.com/llvm/llvm-project/commit/920890e26812f808a74c60ebc14cc636dac661c1 Signed-off-by: Nathan Chancellor --- I highly doubt that 1e300 was intented but if it was (or something else was), please let me know. Commit history wasn't entirely clear on why this expression was used over just a raw number. lib/test_bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test_bpf.c b/lib/test_bpf.c index c41705835cba..5ef3eccee27c 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c @@ -867,7 +867,7 @@ static struct bpf_test tests[] = { }, CLASSIC, { }, - { { 4, 10 ^ 300 }, { 20, 10 ^ 300 } }, + { { 4, 0xA ^ 300 }, { 20, 0xA ^ 300 } }, }, { "SPILL_FILL", -- 2.23.0