Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp763987pxb; Fri, 22 Apr 2022 10:38:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEGsqUg1cgnMBL54Vm47gZXNvT8hilBdie8bM+xxi4d5A0qBWe4vIT1NkUnB39nps7Wd+F X-Received: by 2002:a05:6a00:26ca:b0:50a:6ac7:5014 with SMTP id p10-20020a056a0026ca00b0050a6ac75014mr6116997pfw.81.1650649110917; Fri, 22 Apr 2022 10:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650649110; cv=none; d=google.com; s=arc-20160816; b=b86tD7c8LtSCrf+WBiYpZop7jpI3xqTJEeapmLUXkvdETO993QSVLGNkSZf8MBxXQi gJleS/NVpYn1GdSRJvPESaW3TAa4PVEAa2vyiwO9mCumBNtUQGap8aAtMuB3W97cxy2E yBuIU2Nap2NdANaSdI4nleAe7r//nW/AOtODPnQbVrmvmY5bOpRatUXsmrY+lFI/Dqwj cvq7ihcqPI77k+bku9zyrO+2ryF/H8SxRr1IKm8Sjs7DgsxTuTLiV+chlPDgQLZx/4hI WvToxd3wt5MZaal072l+B2rjeBxZRDFJuo+KWeyyJ8KsT8Nd05CENPV/gTZYg8sSQuhl IZhw== 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:dkim-signature; bh=cbmH4M7d4GLcYeIEHq42CQGiQzmje9WO0ROuhEyNljM=; b=WFGBJD//twW45qjt0PHaA5NtWnp6tA0x43U5v/vgWGhJbc2ullMCzsB7fcn1is6qRd ntcXaNKTN8nGSFMXr4O3gee/34MGha604ywZDAvn+MxpVF4xKgpZ6820ZzAStR4xtxhS 2jvRiBh7diG8l9cP3be3hWVrh5fZW8x0+nQkVcMfwvRzeSoLx5HDnzGLB9yaf98L5L9R kpOW7zSa4UfrJyVBmwW3cnZBLOo8bePdmZ3vMCWhtIX2qMntgxvi9SByHkPP0BYlNT4v ld4neAoj73Yuldb/G5Fti3UbgsQ6uJCsYecpveYgWLP/E3h/uHA+KQjg1dR6ZZVxDTSj z9SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GUe6LtTa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g8-20020a63dd48000000b003aa65f8d687si9302858pgj.480.2022.04.22.10.38.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 10:38:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GUe6LtTa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 29E64E41FF; Fri, 22 Apr 2022 10:28:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344776AbiDUN0k (ORCPT + 99 others); Thu, 21 Apr 2022 09:26:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356500AbiDUN02 (ORCPT ); Thu, 21 Apr 2022 09:26:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8070936E37 for ; Thu, 21 Apr 2022 06:23:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650547404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cbmH4M7d4GLcYeIEHq42CQGiQzmje9WO0ROuhEyNljM=; b=GUe6LtTagkIuhfCb5JXIgwk2dUU8wWh7Q9ezBtgrGHhcdhtKw4x/nmu6C1mMo+vLnap57c qm25NO9/8gd8xu2mTGpyW99traqcyPE76q9wJ3J7AEVo9fvJozyczpIyfBm1Sfa0VlKf2Z 8i3x8nZDXe4/UAcKJGYVnEdSql3DM3U= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-313-4GoSzyGXNYWGSMbuc4VzIA-1; Thu, 21 Apr 2022 09:23:20 -0400 X-MC-Unique: 4GoSzyGXNYWGSMbuc4VzIA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1C7F61014A68; Thu, 21 Apr 2022 13:23:20 +0000 (UTC) Received: from shodan.usersys.redhat.com (unknown [10.43.17.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA385572344; Thu, 21 Apr 2022 13:23:19 +0000 (UTC) Received: by shodan.usersys.redhat.com (Postfix, from userid 1000) id C35B01C016C; Thu, 21 Apr 2022 15:23:18 +0200 (CEST) From: Artem Savkov To: Alan Maguire Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Artem Savkov Subject: [PATCH bpf-next] selftests/bpf: fix prog_tests/uprobe_autoattach compilation error Date: Thu, 21 Apr 2022 15:23:17 +0200 Message-Id: <20220421132317.1583867-1-asavkov@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I am getting the following compilation error for prog_tests/uprobe_autoattach.c tools/testing/selftests/bpf/prog_tests/uprobe_autoattach.c: In function ‘test_uprobe_autoattach’: ./test_progs.h:209:26: error: pointer ‘mem’ may be used after ‘free’ [-Werror=use-after-free] mem variable is now used in one of the asserts so it shouldn't be freed right away. Move free(mem) after the assert block. Fixes: 1717e248014c ("selftests/bpf: Uprobe tests should verify param/return values") Signed-off-by: Artem Savkov --- tools/testing/selftests/bpf/prog_tests/uprobe_autoattach.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_autoattach.c b/tools/testing/selftests/bpf/prog_tests/uprobe_autoattach.c index d6003dc8cc99..35b87c7ba5be 100644 --- a/tools/testing/selftests/bpf/prog_tests/uprobe_autoattach.c +++ b/tools/testing/selftests/bpf/prog_tests/uprobe_autoattach.c @@ -34,7 +34,6 @@ void test_uprobe_autoattach(void) /* trigger & validate shared library u[ret]probes attached by name */ mem = malloc(malloc_sz); - free(mem); ASSERT_EQ(skel->bss->uprobe_byname_parm1, trigger_val, "check_uprobe_byname_parm1"); ASSERT_EQ(skel->bss->uprobe_byname_ran, 1, "check_uprobe_byname_ran"); @@ -44,6 +43,8 @@ void test_uprobe_autoattach(void) ASSERT_EQ(skel->bss->uprobe_byname2_ran, 3, "check_uprobe_byname2_ran"); ASSERT_EQ(skel->bss->uretprobe_byname2_rc, mem, "check_uretprobe_byname2_rc"); ASSERT_EQ(skel->bss->uretprobe_byname2_ran, 4, "check_uretprobe_byname2_ran"); + + free(mem); cleanup: test_uprobe_autoattach__destroy(skel); } -- 2.35.1