Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3927766pxb; Tue, 10 Nov 2020 03:52:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxc0Q2ESe5h1AkyMF+TG/GNzcOw6p5F32q2Zj/wfdPdHTjKpSDBu3niKcdTxkVfvaWZZUz7 X-Received: by 2002:a17:906:3a8c:: with SMTP id y12mr18729607ejd.531.1605009139833; Tue, 10 Nov 2020 03:52:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605009139; cv=none; d=google.com; s=arc-20160816; b=rFa1xI8SPB4lKsSEcSi3HJBX6yH8vnBJTC37zH6TAoitQs8lmkxEVOUi+PHUmbF9AH CZunvjsh3Z2h/pmHgnUjOV79pU4JrEIm57wOiWYwvZb9SKgBvaxNnpRCP9GFZlIGu7/K fZPNLFK2rBRsnH2p7fqK5SA28vE5/fn98nW/y4mJjLvgkWrPW5uDC73reKB66uqVO4ys bV7nRSnugoSNpSf4DCdi6MnFYNsYhr6Sd7ksYdt6vmgEEhNTazT8O4yNtwjQ+5n26hT1 ENnkZI6aa8tgAlLxXUKK4ZprRQAfrKtI/hh1Ys+34z9gmeGZT/rCy7Pu5QpUyBn1VYfG rnXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=p+dPo5Nor05wuovR0c6UnJD/voeXx9YRJtXia/hy3Zw=; b=RygvVsbxVuPcrgMAgUzqXDJsvQX1QpbTozPNCFOFS/X4Sch8mRKTvIEbDMXWMMF5KV 1Xj+LYVlKZcRd9XIOWJfeJdW38PU+U5N+xthGgF+9gsCxb3hWFf1HpZDzgMI58K1Bw4D co20a9IzKQDEbHoyY98qwUYc4MG/QRXOq0bacUBZ98/tfTEVInc3VZ9GlmMU9gPR7Ivw te58llVgeU0/vds/8dPctVfmGPNAut0HAkxZdvHZ0mTUm66HXp3bWF68H9s1o4dBCnEV 4L4+VWfXKk0AGyFtSOqTgZnHdu4LeTdV3WVRFv04IyjVltLyEsKk6XoCKXoLUBmLmGzj CaUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fCg0TgR+; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o5si6803034ejm.525.2020.11.10.03.51.57; Tue, 10 Nov 2020 03:52:19 -0800 (PST) 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=pass header.i=@gmail.com header.s=20161025 header.b=fCg0TgR+; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730059AbgKJLub (ORCPT + 99 others); Tue, 10 Nov 2020 06:50:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726721AbgKJLua (ORCPT ); Tue, 10 Nov 2020 06:50:30 -0500 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D19D7C0613CF; Tue, 10 Nov 2020 03:50:30 -0800 (PST) Received: by mail-pg1-x541.google.com with SMTP id i13so5156046pgm.9; Tue, 10 Nov 2020 03:50:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=p+dPo5Nor05wuovR0c6UnJD/voeXx9YRJtXia/hy3Zw=; b=fCg0TgR+jpA9j9Y/VEr97afhrKhAbL5CDvKaW/BiZ/hckKXTrhB6EcteF272R8ZGHl 8h7kXUZI5/b55N9GDe1Yz25nefwGwVoDeRvp5VRyY8NOHQ/Q5qHQvbT5t1iCkoIGFZ1o 56CF74awHofGO37uIOV5GiBDQI7xEA33IeRtTQ8mMVL1bW87XVZMzOzvIaEvWKAX2lPd o3wGywZwup31qatKFNtxH5vaGmFuYIQWCpPigDO4N52sIAgLLOAl/VbT+t9+RrRv3RbC 4nIvcgGFR4WzJHEawZgNX9EjPmMqlm2GrGMeVUdG3BG6ellwE4HlR6fGPCj7ymRJEUhe G3Tg== 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; bh=p+dPo5Nor05wuovR0c6UnJD/voeXx9YRJtXia/hy3Zw=; b=KS9XGNhLnclrMrSAVjtCwnkL81ybDA9nIu5c0uFipoOrwEVgL1YB5cfejnsbuqULOv 8/fN1vRulhfvlmmCn8jIUzerb32w/JlsHSIYFMxK5wSGSAS7Ft8S+PUyfn0HokjzspQ/ ce+sJxPuQb10yKXRPHubT7f/W40naOJOr4kUtbalhScQ8RUxaQH5JUrZLBAcPME7fHtK RJPN9hM5zR6wM6kI6KsYiG4ECFwBWVHIcoVaaow55tKR+UBwRUzG3AmsmWmyprFNlxpC /PsAHT0jQYtkdWxScPryf1WeUkrQr4oMT+9vUpM78fWTmtdDI9cFOWhcAs9KwQ4ep9yX +ezQ== X-Gm-Message-State: AOAM531z2SWVbObBeEOtNXzt/UPaxNPbnnc7tOfH4Lt+ZmYmAII/JDrD BtalffHl42ruhLpZ19/UsA== X-Received: by 2002:a62:b417:0:b029:18b:8c55:849f with SMTP id h23-20020a62b4170000b029018b8c55849fmr17446444pfn.27.1605009030471; Tue, 10 Nov 2020 03:50:30 -0800 (PST) Received: from he-cluster.localdomain (67.216.221.250.16clouds.com. [67.216.221.250]) by smtp.gmail.com with ESMTPSA id t18sm2978679pjs.56.2020.11.10.03.50.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Nov 2020 03:50:29 -0800 (PST) From: xiakaixu1987@gmail.com X-Google-Original-From: kaixuxia@tencent.com To: ast@kernel.org, daniel@iogearbox.net, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, andrii@kernel.org, john.fastabend@gmail.com, kpsingh@chromium.org Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Kaixu Xia Subject: [PATCH] bpf: Fix unsigned 'datasec_id' compared with zero in check_pseudo_btf_id Date: Tue, 10 Nov 2020 19:50:19 +0800 Message-Id: <1605009019-22310-1-git-send-email-kaixuxia@tencent.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kaixu Xia The unsigned variable datasec_id is assigned a return value from the call to check_pseudo_btf_id(), which may return negative error code. Fixes coccicheck warning: ./kernel/bpf/verifier.c:9616:5-15: WARNING: Unsigned expression compared with zero: datasec_id > 0 Reported-by: Tosk Robot Signed-off-by: Kaixu Xia --- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 6200519582a6..e9d8d4309bb4 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -9572,7 +9572,7 @@ static int check_pseudo_btf_id(struct bpf_verifier_env *env, struct bpf_insn *insn, struct bpf_insn_aux_data *aux) { - u32 datasec_id, type, id = insn->imm; + s32 datasec_id, type, id = insn->imm; const struct btf_var_secinfo *vsi; const struct btf_type *datasec; const struct btf_type *t; -- 2.20.0