From nobody Fri Jan 2 03:32:50 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BEF8CDB465 for ; Mon, 16 Oct 2023 14:09:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233562AbjJPOJJ (ORCPT ); Mon, 16 Oct 2023 10:09:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229784AbjJPOJI (ORCPT ); Mon, 16 Oct 2023 10:09:08 -0400 Received: from mx0.infotecs.ru (mx0.infotecs.ru [91.244.183.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E6FB9F; Mon, 16 Oct 2023 07:09:04 -0700 (PDT) Received: from mx0.infotecs-nt (localhost [127.0.0.1]) by mx0.infotecs.ru (Postfix) with ESMTP id 2E58610D45E4; Mon, 16 Oct 2023 17:09:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx0.infotecs.ru 2E58610D45E4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=infotecs.ru; s=mx; t=1697465340; bh=+ZC8GtdyCkRDxzr5JIpKd7VwUl5MmIl1Af5SMfJNu+M=; h=From:To:CC:Subject:Date:From; b=g9ekjkro5OTpLaHHhJsqrXI7Zv+df7nSf73SdJugv1btmf57bBwDj2ao952WWQxU/ O8GftW08kqj6+7TO1EUBUiIksrGEEzHoa+liB9EDw0TiDg3Bem9G137a4oAj/JecXw SZpQrvrvUmf0dk1Jv/or0ZiulZf4YXDxkQI/Lloo= Received: from msk-exch-02.infotecs-nt (msk-exch-02.infotecs-nt [10.0.7.192]) by mx0.infotecs-nt (Postfix) with ESMTP id 2ACAE309B5EE; Mon, 16 Oct 2023 17:09:00 +0300 (MSK) From: Gavrilov Ilia To: "David S. Miller" CC: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jason Gunthorpe , "Greg Kroah-Hartman" , "Jason A. Donenfeld" , Kees Cook , Yunsheng Lin , Dmitry Safonov <0x7f454c46@gmail.com>, "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "lvc-project@linuxtesting.org" Subject: [PATCH net] net: pktgen: Fix interface flags printing Thread-Topic: [PATCH net] net: pktgen: Fix interface flags printing Thread-Index: AQHaADpPvpSeWfXDTUmbVpNurCN1KQ== Date: Mon, 16 Oct 2023 14:08:59 +0000 Message-ID: <20231016140631.1245318-1-Ilia.Gavrilov@infotecs.ru> Accept-Language: ru-RU, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.17.0.10] x-exclaimer-md-config: 208ac3cd-1ed4-4982-a353-bdefac89ac0a Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-KLMS-Rule-ID: 5 X-KLMS-Message-Action: clean X-KLMS-AntiSpam-Status: not scanned, disabled by settings X-KLMS-AntiSpam-Interceptor-Info: not scanned X-KLMS-AntiPhishing: Clean, bases: 2023/10/16 11:09:00 X-KLMS-AntiVirus: Kaspersky Security for Linux Mail Server, version 8.0.3.30, bases: 2023/10/16 12:06:00 #22200180 X-KLMS-AntiVirus-Status: Clean, skipped Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Device flags are displayed incorrectly: 1) The comparison (i =3D=3D F_FLOW_SEQ) is always false, because F_FLOW_SEQ is equal to (1 << FLOW_SEQ_SHIFT) =3D=3D 2048, and the maximum value of the 'i' variable is (NR_PKT_FLAG - 1) =3D=3D 17. It should be compared with FLOW_SEQ_SHIFT. 2) Similarly to the F_IPSEC flag. 3) Also add spaces to the print end of the string literal "spi:%u" to prevent the output from merging with the flag that follows. Found by InfoTeCS on behalf of Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 99c6d3d20d62 ("pktgen: Remove brute-force printing of flags") Signed-off-by: Gavrilov Ilia --- net/core/pktgen.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/net/core/pktgen.c b/net/core/pktgen.c index f56b8d697014..4d1696677c48 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -669,19 +669,19 @@ static int pktgen_if_show(struct seq_file *seq, void = *v) seq_puts(seq, " Flags: "); =20 for (i =3D 0; i < NR_PKT_FLAGS; i++) { - if (i =3D=3D F_FLOW_SEQ) + if (i =3D=3D FLOW_SEQ_SHIFT) if (!pkt_dev->cflows) continue; =20 - if (pkt_dev->flags & (1 << i)) + if (pkt_dev->flags & (1 << i)) { seq_printf(seq, "%s ", pkt_flag_names[i]); - else if (i =3D=3D F_FLOW_SEQ) - seq_puts(seq, "FLOW_RND "); - #ifdef CONFIG_XFRM - if (i =3D=3D F_IPSEC && pkt_dev->spi) - seq_printf(seq, "spi:%u", pkt_dev->spi); + if (i =3D=3D IPSEC_SHIFT && pkt_dev->spi) + seq_printf(seq, "spi:%u ", pkt_dev->spi); #endif + } else if (i =3D=3D FLOW_SEQ_SHIFT) { + seq_puts(seq, "FLOW_RND "); + } } =20 seq_puts(seq, "\n"); --=20 2.39.2