From patchwork Thu Jan 3 18:57:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Fomichev X-Patchwork-Id: 1020479 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="T2Xfn4xD"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43VxxJ1Cm1z9s3l for ; Fri, 4 Jan 2019 05:57:23 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726645AbfACS5W (ORCPT ); Thu, 3 Jan 2019 13:57:22 -0500 Received: from mail-pf1-f201.google.com ([209.85.210.201]:36921 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726564AbfACS5W (ORCPT ); Thu, 3 Jan 2019 13:57:22 -0500 Received: by mail-pf1-f201.google.com with SMTP id i3so35446313pfj.4 for ; Thu, 03 Jan 2019 10:57:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=nPGSKwKjdA4mPMwaD5PZCaVh2y3LNR3fO04+0H7783w=; b=T2Xfn4xDlQZwbtQUPtRWt6A6jWOwetVcUy80eQR1zBXxtO0YpoGMIAyEfmw8BUDFsV dXcaTqSShCxCFu7HFRYdfpaIYs/q0jky6ne/RNNxRrk/DiUVvQU3QOGzbhEw159hE7Sl zoUOTZtAZX/5n91jMW5F7ucI6/L7Xe3KGXk12x4OMU5vzCHn57wJ8HSTg5ZrgId6DsNu yHSYFyMB2jVJm/1+UVJ2d1FriHDxYx3/XcxpkLUjaqzgcap/aVlm9y2FT3eDZrxA4PNj qnuNqYX4sdDbiFiLKJUmdBujtSMwBA97hwt3tXnpFxdKMdhrEHBEiCrVXHlcbGhGhgxJ /1pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=nPGSKwKjdA4mPMwaD5PZCaVh2y3LNR3fO04+0H7783w=; b=IrpHCitBMsg0p+/ECP2F9fD5fKkheyVd+VKQlSCKk/kF9Mj7izBmUTEAnoFZo3CuoT 5NDb27AjptV124JPPDLwz10MUzT7OvDfE45M4RvlB+/n9mAa2kqvhduoxIonA6s+lHQa n5ozFmIB8E9lTbqmRGxoWpN8DKTDbEgkFVD2z9DEOKDznaVVDMvsazRFWwO+gX+J+Wmh LUOhg9YX4xtijX+fTIIg96VAETl+6F5JhIPvm/Fntw5oeBKuyw1B66uesTE1z3N98Vr/ q0RqLx1Z0rRXz5ew4VeRN0DHOV1WMmzieJcXPASF9q7e+GsYuhMqEcyv765Rs8M7NvZz 0Xaw== X-Gm-Message-State: AJcUukdAU2Jg/3/9TwilkIcUSGe4mm/+LVndCoz+jKjpixNK3aLRfcOw 2vE3+Fc6A39d2Fnl0mSNTDJbKPechPl+UCQaX/d9n5ahyGFUR+/b1iIvlpY2RqIajkfV8HYhVOR 811j46JfiInopAg1yAb4sL9rJ1xFI0QN0OeVxYg7OJbGxbc/gYekctg== X-Google-Smtp-Source: ALg8bN64gl4dSj9tCnSuJF7qkop91EgwhQgxQNurGeikU6si2SSVfF/e2eiNX1/bLagxLN+XCsDbZp4= X-Received: by 2002:a17:902:d70c:: with SMTP id w12mr18519919ply.45.1546541841407; Thu, 03 Jan 2019 10:57:21 -0800 (PST) Date: Thu, 3 Jan 2019 10:57:17 -0800 Message-Id: <20190103185717.58134-1-sdf@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.20.1.415.g653613c723-goog Subject: [PATCH bpf] selftests/bpf: fix incorrect users of create_and_get_cgroup From: Stanislav Fomichev To: netdev@vger.kernel.org Cc: davem@davemloft.net, ast@kernel.org, daniel@iogearbox.net, Stanislav Fomichev Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org create_and_get_cgroup returns 0 on error, fix the users that assume negative value in case of an error. Signed-off-by: Stanislav Fomichev Acked-by: Yonghong Song --- tools/testing/selftests/bpf/get_cgroup_id_user.c | 2 +- tools/testing/selftests/bpf/test_sockmap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/get_cgroup_id_user.c b/tools/testing/selftests/bpf/get_cgroup_id_user.c index e8da7b39158d..dfaa9b353ac3 100644 --- a/tools/testing/selftests/bpf/get_cgroup_id_user.c +++ b/tools/testing/selftests/bpf/get_cgroup_id_user.c @@ -64,7 +64,7 @@ int main(int argc, char **argv) return 1; cgroup_fd = create_and_get_cgroup(TEST_CGROUP); - if (CHECK(cgroup_fd < 0, "create_and_get_cgroup", "err %d errno %d\n", + if (CHECK(!cgroup_fd, "create_and_get_cgroup", "err %d errno %d\n", cgroup_fd, errno)) goto cleanup_cgroup_env; diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c index e85a771f607b..2384896e8112 100644 --- a/tools/testing/selftests/bpf/test_sockmap.c +++ b/tools/testing/selftests/bpf/test_sockmap.c @@ -1676,7 +1676,7 @@ static int __test_suite(int cg_fd, char *bpf_file) } cg_fd = create_and_get_cgroup(CG_PATH); - if (cg_fd < 0) { + if (!cg_fd) { fprintf(stderr, "ERROR: (%i) open cg path failed: %s\n", cg_fd, optarg);