From patchwork Tue Jun 6 11:30:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 13268968 X-Patchwork-Delegate: bpf@iogearbox.net Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3FB0A468F for ; Tue, 6 Jun 2023 11:30:56 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E6CD10CE for ; Tue, 6 Jun 2023 04:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686051050; 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=THNTZnYMM07LI45sj7hAi9Sw3qoEfQIukm8Ha8a3v04=; b=L8MctznQmdhsC7xxSDpvX4z+vDi5guH4Uw11aYvnZLYIjYvyFBFo6o70OOxJN5hPar941y 64Omf7rNzyvFG+LplwIeLMi145wKJheq6qKrVSjx4OtonYjvRfIgJqcyjrIQ+mr2sbQEFK Xm/NUCX6V/k4PS/Xjzvor+RTyT2Ty0k= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-528-wy1ADC0dMfypBcWJd0UhRw-1; Tue, 06 Jun 2023 07:30:49 -0400 X-MC-Unique: wy1ADC0dMfypBcWJd0UhRw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B382B2932489; Tue, 6 Jun 2023 11:30:48 +0000 (UTC) Received: from firesoul.localdomain (unknown [10.45.242.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 610BD1121315; Tue, 6 Jun 2023 11:30:48 +0000 (UTC) Received: from [10.1.1.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 6D313307372E8; Tue, 6 Jun 2023 13:30:47 +0200 (CEST) Subject: [PATCH bpf-next V1] selftests/bpf: Fix check_mtu using wrong variable type From: Jesper Dangaard Brouer To: Daniel Borkmann , Alexei Starovoitov , Andrii Nakryiko , bpf@vger.kernel.org Cc: Jesper Dangaard Brouer , netdev@vger.kernel.org, kernel-janitors@vger.kernel.org Date: Tue, 06 Jun 2023 13:30:47 +0200 Message-ID: <168605104733.3636467.17945947801753092590.stgit@firesoul> User-Agent: StGit/1.4 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: bpf@iogearbox.net Dan Carpenter found via Smatch static checker, that unsigned 'mtu_lo' is never less than zero. Variable mtu_lo should have been an 'int', because read_mtu_device_lo() uses minus as error indications. Reported-by: Dan Carpenter Signed-off-by: Jesper Dangaard Brouer Reviewed-by: Simon Horman --- tools/testing/selftests/bpf/prog_tests/check_mtu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/check_mtu.c b/tools/testing/selftests/bpf/prog_tests/check_mtu.c index 5338d2ea0460..2a9a30650350 100644 --- a/tools/testing/selftests/bpf/prog_tests/check_mtu.c +++ b/tools/testing/selftests/bpf/prog_tests/check_mtu.c @@ -183,7 +183,7 @@ static void test_check_mtu_tc(__u32 mtu, __u32 ifindex) void serial_test_check_mtu(void) { - __u32 mtu_lo; + int mtu_lo; if (test__start_subtest("bpf_check_mtu XDP-attach")) test_check_mtu_xdp_attach();