Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp217802pxj; Fri, 28 May 2021 02:13:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiLQbzc0GkPDQSmHysSAWNqfLVALaM+s8IhMIMxEZepmv3kaqtrWGOdldFiiyR8ssyB78p X-Received: by 2002:a05:6402:188:: with SMTP id r8mr8640205edv.75.1622193187343; Fri, 28 May 2021 02:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622193187; cv=none; d=google.com; s=arc-20160816; b=WTCel8gWLwSI6Xn5l5Az74MKVqZVL7/Kcuv66Jk0foRwBO02LcZUsfNg0loxDNf2/v WJScB8ca8xX126sfCKKH6sPYASmDNLffGn4Sx//uZeSf6g0J/dlVOwjc4A6/Kuk5NqRG UGZ2By7pIHLVQBoQJH5t/fYorACZsFJm2hwAM3BMnPymqHAskmaq+61pQxQ9kCCatvRR VyuWtv83UO8SysYZnLpr/4qMuezPVW0av0tFzugec87Wq2rElgLCbo+t48uTTD9aLeXQ MhSvSIpTcTRJq8tFabCf4rFab8wTTUQ/ll5goKyP+FmpV9JxatwIJDTkHytvW+Erj+u3 byEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=UCazsrxM1AHsnVujgQVrMSluZgFLgGwc7ZZ1ASet4bw=; b=gqOtizEUaaZJ8CbW7UyfcuKEjUFlRIoPuLgREOn5WVSkMdBfRHSM12K2IR4KVRDD6D voOPlrxIeM4qBENwsraxxuB9rJa5BX5Xao0R3343UMgyfiMY2uTzlkHYqvg/8sCwyN+z zm2tctnGLyv4ScNZk55F0tD7V0YVVrHVOvEqw0IMmCrIb+z1gfqSqPXVvb0TGNy+AIPF +zYTZEobd0FOaI5oLkeU7GClzD4L1tTT9X2NebD9TqRtCkyVJZpxqD1/XlI32THVyro0 yvT8GgNpnIzCUFIyzRtwTKlkULUOhebw/qD9tOUAf5Q9a5pT6bLjNqQDDRU2Vz+YtMzb mDzw== ARC-Authentication-Results: i=1; mx.google.com; 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=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qk10si4475006ejb.218.2021.05.28.02.12.42; Fri, 28 May 2021 02:13:07 -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; 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=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236076AbhE1JAS (ORCPT + 99 others); Fri, 28 May 2021 05:00:18 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:2076 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbhE1JAR (ORCPT ); Fri, 28 May 2021 05:00:17 -0400 Received: from dggeml767-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Frz4r4kVqzWnqs; Fri, 28 May 2021 16:54:04 +0800 (CST) Received: from dggema762-chm.china.huawei.com (10.1.198.204) by dggeml767-chm.china.huawei.com (10.1.199.177) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 28 May 2021 16:58:40 +0800 Received: from huawei.com (10.175.127.227) by dggema762-chm.china.huawei.com (10.1.198.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 28 May 2021 16:58:40 +0800 From: Yu Kuai To: , , , CC: , , , , , Subject: [PATCH] selftests/bpf: Fix return value check in attach_bpf() Date: Fri, 28 May 2021 17:07:58 +0800 Message-ID: <20210528090758.1108464-1-yukuai3@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggema762-chm.china.huawei.com (10.1.198.204) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org use libbpf_get_error() to check the return value of bpf_program__attach(). Reported-by: Hulk Robot Signed-off-by: Yu Kuai --- tools/testing/selftests/bpf/benchs/bench_rename.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/benchs/bench_rename.c b/tools/testing/selftests/bpf/benchs/bench_rename.c index c7ec114eca56..b7d4a1d74fca 100644 --- a/tools/testing/selftests/bpf/benchs/bench_rename.c +++ b/tools/testing/selftests/bpf/benchs/bench_rename.c @@ -65,7 +65,7 @@ static void attach_bpf(struct bpf_program *prog) struct bpf_link *link; link = bpf_program__attach(prog); - if (!link) { + if (libbpf_get_error(link)) { fprintf(stderr, "failed to attach program!\n"); exit(1); } -- 2.25.4