Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp825196pxk; Thu, 3 Sep 2020 13:38:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQuQxFs1SHekY7ZCQv33WNKl3Q0QLsP8BusLvpAEE4l0d4Qw24ySahGK1kbPmsUvOBwzab X-Received: by 2002:aa7:d4d2:: with SMTP id t18mr5022850edr.55.1599165494391; Thu, 03 Sep 2020 13:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599165494; cv=none; d=google.com; s=arc-20160816; b=X8g8bjqthp87VzU0WQZeYNC6U9ZXNqKyGvyYLQCZ1ymZGEyJeN0qUerbNACUE/QHnw BloaGE3Qe9AXdXUmsZfR5rFvvB3/eFpI7oZf1oMm513c5Ymh31MpYE4Z9tpOK4K0xLky 1v0m44txmQQUuQuTpOrTZVgztKrmJDziqUHMMQs0Hy3LA9O7iG8XgjawMyeb1nltQf+u WbsrgvjAgoQSShSidylXx7bzOY9qkoKHGyvgpXh89C6xM+ZIH8U7191/a/92ADN/iv4j p3X1lF0kdqRHT00yHwR7l7mLYmbR2HnS4Lcq8SSKvrOel/LsGIEyc+fd1+Vgwg80ANE/ WdYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=2E7KS28zfC4tVsTRRkYzuj1mxceg9YfnccbGKN5EM2Y=; b=JxDwAj/W5aFHklJ/fvjLYVuBDXlOBxZnAQzX+IUiWG/ZNenbd6jVHQ2PIU6TJdfCTv xW7SA2hC01/W3IEzGsFh0jG4Dit4DF49nGHXIqDQeOhJ+BtGRznHL+yQj1ZKHmoG/N3t TIcUG7bwwfHxcho8zCbKxY9bzVnkrn/jJP2zxmpI9rltfNd9mGFwUOd1sFpPsteLyQkH mNa8C9+gD6yatdCD7gRoDXqP9+uzHqLBExWe9OVC6PTV6GNAmtOVLlnfulOGzbaNwEbT X0iox9SZ0umCajBy6dYhMFUYQINM2R3Is3tzS8yzDNKdaTeG5uWaOC7cfylU5Sa1ik73 NAbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=b8Z56R9v; 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 k25si2513143edv.381.2020.09.03.13.37.51; Thu, 03 Sep 2020 13:38:14 -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=pass header.i=@gmail.com header.s=20161025 header.b=b8Z56R9v; 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 S1729747AbgICUhN (ORCPT + 99 others); Thu, 3 Sep 2020 16:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729729AbgICUg5 (ORCPT ); Thu, 3 Sep 2020 16:36:57 -0400 Received: from mail-yb1-xb44.google.com (mail-yb1-xb44.google.com [IPv6:2607:f8b0:4864:20::b44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26802C061244; Thu, 3 Sep 2020 13:36:57 -0700 (PDT) Received: by mail-yb1-xb44.google.com with SMTP id q3so3054177ybp.7; Thu, 03 Sep 2020 13:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2E7KS28zfC4tVsTRRkYzuj1mxceg9YfnccbGKN5EM2Y=; b=b8Z56R9vFCgocfa8RWukYzYWSYA3gtr6wje77Wssz6K+yjxqD8f20ntZRZheoOVV+v BDgrP0DtuIjNozxXUxj5gCg9caRvd/P+tM9finPeseB/BU1EGEVNuDDUCUhc6fRW0+nv ipw4HTaUQsw0mD/UVxhcoksGGtRHcfpjSL9gdBe9rLiF683BWUicBR0v5tH9ve/YOECY CRBkxBs6Drv3tPFtYRZzKysdE0NXzSFgndTRv8sHMiGEPIn/N3Hy6jz0Y1HBJtbaGfQs 2tl62L8jQBmWUR4YbZ+pMBird4XhD+ApWBH/laeIzawJImWgckQ8geGawy72noVBmYN7 2BYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2E7KS28zfC4tVsTRRkYzuj1mxceg9YfnccbGKN5EM2Y=; b=F3Yb6WkV5Ht9SqyzXYDGFKnBQWJmOR0w2OhERh83PfsCB56mSjQhLx2QkGDgs+WXC3 a2hkwpVcjOPkGaUjadZhQYr4C3fNEejj6aYE9Q6y9j2tukXA2nqhDESGaMmNvGWfos5Q xrfipchqB7H7gS4A5t1xZGXfvvPcRMRXLvtMrgQocMWBzHIXorc8WS5FHm7bJDx2shJR nY1ooQk2T3yzTEYphbhLL6y5i+aezOKPRts4A5QG8u3FogP9zH0O9nLC+20Tl8+qbguP p5Etq+bgxM2HN5l67lGt9U1TXOCYQim/J4WOtGaF5bQpMswMuXJcsec0/+vnZqeEbHYH uI7w== X-Gm-Message-State: AOAM532HTyYh5kJKbsH9b59IZpJLToqbSoV5DHMjudwzLqo5KjOCFBjC orA0XKfQruoENGPFoBBQILl6rgA7YPljT1itV5U= X-Received: by 2002:a25:6885:: with SMTP id d127mr5150392ybc.27.1599165416443; Thu, 03 Sep 2020 13:36:56 -0700 (PDT) MIME-Version: 1.0 References: <20200903200528.747884-1-haoluo@google.com> In-Reply-To: <20200903200528.747884-1-haoluo@google.com> From: Andrii Nakryiko Date: Thu, 3 Sep 2020 13:36:45 -0700 Message-ID: Subject: Re: [PATCH] selftests/bpf: Fix check in global_data_init. To: Hao Luo Cc: Networking , bpf , open list , "open list:KERNEL SELFTEST FRAMEWORK" , Shuah Khan , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= , KP Singh Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 3, 2020 at 1:06 PM Hao Luo wrote: > > The returned value of bpf_object__open_file() should be checked with > libbpf_get_error() rather than NULL. This fix prevents test_progs from > crash when test_global_data.o is not present. > > Signed-off-by: Hao Luo > --- thanks! Acked-by: Andrii Nakryiko > tools/testing/selftests/bpf/prog_tests/global_data_init.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/bpf/prog_tests/global_data_init.c b/tools/testing/selftests/bpf/prog_tests/global_data_init.c > index 3bdaa5a40744..ee46b11f1f9a 100644 > --- a/tools/testing/selftests/bpf/prog_tests/global_data_init.c > +++ b/tools/testing/selftests/bpf/prog_tests/global_data_init.c > @@ -12,7 +12,8 @@ void test_global_data_init(void) > size_t sz; > > obj = bpf_object__open_file(file, NULL); > - if (CHECK_FAIL(!obj)) > + err = libbpf_get_error(obj); > + if (CHECK_FAIL(err)) > return; > > map = bpf_object__find_map_by_name(obj, "test_glo.rodata"); > -- > 2.28.0.526.ge36021eeef-goog >