Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1898638ybj; Wed, 6 May 2020 07:19:32 -0700 (PDT) X-Google-Smtp-Source: APiQypKYgg/SP8z2lvsdWo7U50qi6atEvEDz9cGi1ArA/zf2d38pjT6HffWnGol1Sw4G4Vjyh+rN X-Received: by 2002:a17:907:43c2:: with SMTP id i2mr7584217ejs.185.1588774772234; Wed, 06 May 2020 07:19:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588774772; cv=none; d=google.com; s=arc-20160816; b=W8ZH7nvDIGlEQ/8UM3ozuCRAam4VyupaIse08R8bAD8Lwq73i0/3VEKZA3+RVSOHIW oXKfucFMEWKkgSRwMHJN4bSZsWgY95QmKH1UFNg3SXy9GWHrOXoe5TI2ymKbYUF81GuC BiN8dcm/GRIbtmR2kgVKIeOCbJtWVxqHrzEu9lAF9xMqJO8GaFof/LPToOYjmuwI57aw etWiB4FGiLwH277HW9dc6jw4ZlDGSgNDZJq7S3lh3ASyf4FHrOrP+kUShn17tg63Ny2T oo31jzj7sBnjd29ZnB+FZIAoWFljeKOHlyfOUDv4gXYZT6v1up5rpJW3X/+RLXhZac9O 8wow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:dkim-signature:dkim-filter; bh=2t81ix48+XEqIovy4/uuaiJNVpVfGfHkdc5n10MqWF4=; b=IhZRoA5ttdJCdeLVqzCa9zCQSI1gE5ww7tGvkJLtrPREKQrWWil2KZPvXEOe/hCrUL ig0BHuG4goZPypCj6ZnGbOHCKu45RCuVvDu/w06uGTrDKvVm8tGTqmJ4QgSzGfB8R1Vk d5lPuqMOsdG//81880RUdC/9TZd+jHQl1AaLwWUOOVb6sKjLmWfFHGkvNiUyaOYsScbt /EP/cUf/BAr36KTmG11z8AbP8b4hzgkEdrha1T5zFd0Gkt2gMRkCGZQFuFomcOLcRsPg bAo+2wDRKibSb9AF4pPTqbAf7MND9thm/9Z0PunASGQ2WLXk+wYcSILqJodK+Tnjnbk/ 80Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@zytor.com header.s=2020042201 header.b=ETbnGxm8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p9si1199055ejf.493.2020.05.06.07.19.05; Wed, 06 May 2020 07:19:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@zytor.com header.s=2020042201 header.b=ETbnGxm8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728929AbgEFORh (ORCPT + 99 others); Wed, 6 May 2020 10:17:37 -0400 Received: from terminus.zytor.com ([198.137.202.136]:57243 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728670AbgEFORh (ORCPT ); Wed, 6 May 2020 10:17:37 -0400 Received: from [IPv6:2601:646:8600:3281:d9e2:e16d:2ce4:a5c3] ([IPv6:2601:646:8600:3281:d9e2:e16d:2ce4:a5c3]) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id 046EGISp3022440 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Wed, 6 May 2020 07:16:20 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 046EGISp3022440 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2020042201; t=1588774580; bh=2t81ix48+XEqIovy4/uuaiJNVpVfGfHkdc5n10MqWF4=; h=Date:In-Reply-To:References:Subject:To:From:From; b=ETbnGxm8J7xr65vxrUydccH3oDZPr6ssZbQrpdFDLaJeehBoK3COvrkjxemldJ7Kx Sa52fbj6LykWgbqsauISnLs58GZlGFQSwp79DKsiE1odTeSOahoIzKxZbKYslRZtx0 leFQHs/2egU6BRZTlK0L2B6oIkbgaI2b94xuQ4hRk4PQFHIuoTwmGAvAjJP3lp8BMK zUtyWynNJ6BlmrLVpoB2QgQIliA5HiCUHfX7pco+BKXdU7t7orRcmmE0/IvCMP0sE0 PY/U2uGwLk/0CeWvIzDjVdiuqMmSLvMaZFW9KlUXKXXlYlfF7y6ZcnDqnTxh9U/8cl nnKRsNJVAHEHA== Date: Wed, 06 May 2020 07:16:11 -0700 User-Agent: K-9 Mail for Android In-Reply-To: <20200506140352.37154-1-yanaijie@huawei.com> References: <20200506140352.37154-1-yanaijie@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH v2] bpf, i386: remove unneeded conversion to bool To: Jason Yan , davem@davemloft.net, kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, udknight@gmail.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, ast@kernel.org, daniel@iogearbox.net, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, andriin@fb.com, john.fastabend@gmail.com, kpsingh@chromium.org, lukenels@cs.washington.edu, xi.wang@gmail.com, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org From: hpa@zytor.com Message-ID: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On May 6, 2020 7:03:52 AM PDT, Jason Yan wrote: >The '=3D=3D' expression itself is bool, no need to convert it to bool >again=2E >This fixes the following coccicheck warning: > >arch/x86/net/bpf_jit_comp32=2Ec:1478:50-55: WARNING: conversion to bool >not needed here >arch/x86/net/bpf_jit_comp32=2Ec:1479:50-55: WARNING: conversion to bool >not needed here > >Signed-off-by: Jason Yan >--- > v2: change the name 'x32' to 'i386'=2E > > arch/x86/net/bpf_jit_comp32=2Ec | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/arch/x86/net/bpf_jit_comp32=2Ec >b/arch/x86/net/bpf_jit_comp32=2Ec >index 66cd150b7e54=2E=2E96fde03aa987 100644 >--- a/arch/x86/net/bpf_jit_comp32=2Ec >+++ b/arch/x86/net/bpf_jit_comp32=2Ec >@@ -1475,8 +1475,8 @@ static int do_jit(struct bpf_prog *bpf_prog, int >*addrs, u8 *image, > for (i =3D 0; i < insn_cnt; i++, insn++) { > const s32 imm32 =3D insn->imm; > const bool is64 =3D BPF_CLASS(insn->code) =3D=3D BPF_ALU64; >- const bool dstk =3D insn->dst_reg =3D=3D BPF_REG_AX ? false : true; >- const bool sstk =3D insn->src_reg =3D=3D BPF_REG_AX ? false : true; >+ const bool dstk =3D insn->dst_reg !=3D BPF_REG_AX; >+ const bool sstk =3D insn->src_reg !=3D BPF_REG_AX; > const u8 code =3D insn->code; > const u8 *dst =3D bpf2ia32[insn->dst_reg]; > const u8 *src =3D bpf2ia32[insn->src_reg]; "foo ? true : false" is also far better written !!foo when it isn't totall= y redundant=2E --=20 Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E