From patchwork Wed Jun 28 23:38:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13296430 X-Patchwork-Delegate: dsahern@gmail.com 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 59DEB11185 for ; Wed, 28 Jun 2023 23:38:19 +0000 (UTC) Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38D4E1BDF for ; Wed, 28 Jun 2023 16:38:18 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1b80ddce748so661635ad.3 for ; Wed, 28 Jun 2023 16:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1687995497; x=1690587497; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y+7VmZFDHYdTl/J7POY8Q85vpg2oR4oUgRKjOWkmrcQ=; b=bWKr/eOf67zNMKDTWsMNLC9U/VX/qZ9T+sL93jrCi3BXD9XKBhIal8UQAokECwjtik JsZgOh+3zpiC+G9zgfrBTttcWwy75k56h+4KBtohkkb97F2OXiwaJYzDwFgH7EPMjqWC ItNjcyGxMcVsP4bIqDoFn534bRsu1JgZ5eF1GGzn18i8fozpjpiMDLKdYwlM6xFH+jYT x1m6yjALxo8JNQmKsdyb3bUl9+9tyJyOT7tUIypmc1Uj8Bxag3GIEGS37k7qBAmQsWky O4u4kQTq9WIK6zewmXh43FBhWXZBQ+ImsHok1lY9pY8v6zoMbHG6t+0R5u34Kw0n90cq qBfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687995497; x=1690587497; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y+7VmZFDHYdTl/J7POY8Q85vpg2oR4oUgRKjOWkmrcQ=; b=cN72MhJBW0MO1B1SvOuoeI5J1nq4tx+b7GGgLyhj/fba6Pol5aY+O8OH4GG2A9aeYX yjkF335yPQg+LbSqqQ5Nb1nqF4APfJGoqBEIPfKPFcny0wM7RY0Eo4X0Dyeh1ootxh8L MtIWLgg2tDyZBUk2BXLMFtYHOLjHnrv9cgWdOPr2NQ5drsnv7CW34ir3XHjcjXQiDKbJ f/PwrObouZnnFgWGPx0EqiBfc97rwJbxkYl+hRU4njiWTcKFVDONNzYKc1X2so6b+cdY gnVMbJ+lwasrNcVVHztftlcSaxTQ6hAhb1U4/vL3QvRA0Bg1qc+/TJkQ5RNJv5GUXAam Nw0w== X-Gm-Message-State: AC+VfDwVeFCffSoBHWUv0/VyuLqZr9K0CSfvyhGjoMiqdZMyc8MH1GEo QOY7cK+AwlscI5t4z4OJhQ6kyYZCyz0xCZamZx6FnQ== X-Google-Smtp-Source: ACHHUZ7pvaMXIGblilwJCRl+wfu7npl7dJzWXvFGJ7euCvihE+UshanpnhC9aCr/9dFnCf7g7+0Nhw== X-Received: by 2002:a17:902:7591:b0:1b1:76c2:296a with SMTP id j17-20020a170902759100b001b176c2296amr8985472pll.60.1687995497381; Wed, 28 Jun 2023 16:38:17 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id s18-20020a170902a51200b001b7fb1a8200sm6437196plq.258.2023.06.28.16.38.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 16:38:16 -0700 (PDT) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2 1/5] dcb: fully initialize flag table Date: Wed, 28 Jun 2023 16:38:09 -0700 Message-Id: <20230628233813.6564-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230628233813.6564-1-stephen@networkplumber.org> References: <20230628233813.6564-1-stephen@networkplumber.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, 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: dsahern@gmail.com And make the flag table const since only used for lookup. Signed-off-by: Stephen Hemminger Reviewed-by: Petr Machata --- dcb/dcb_dcbx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dcb/dcb_dcbx.c b/dcb/dcb_dcbx.c index 244b671b893b..9e3dd2a0af87 100644 --- a/dcb/dcb_dcbx.c +++ b/dcb/dcb_dcbx.c @@ -42,12 +42,12 @@ struct dcb_dcbx_flag { const char *key_json; }; -static struct dcb_dcbx_flag dcb_dcbx_flags[] = { - {DCB_CAP_DCBX_HOST, "host"}, - {DCB_CAP_DCBX_LLD_MANAGED, "lld-managed", "lld_managed"}, - {DCB_CAP_DCBX_VER_CEE, "cee"}, - {DCB_CAP_DCBX_VER_IEEE, "ieee"}, - {DCB_CAP_DCBX_STATIC, "static"}, +static const struct dcb_dcbx_flag dcb_dcbx_flags[] = { + {DCB_CAP_DCBX_HOST, "host", NULL }, + {DCB_CAP_DCBX_LLD_MANAGED, "lld-managed", "lld_managed" }, + {DCB_CAP_DCBX_VER_CEE, "cee", NULL }, + {DCB_CAP_DCBX_VER_IEEE, "ieee", NULL }, + {DCB_CAP_DCBX_STATIC, "static", NULL }, }; static void dcb_dcbx_print(__u8 dcbx) @@ -60,7 +60,7 @@ static void dcb_dcbx_print(__u8 dcbx) bit--; for (i = 0; i < ARRAY_SIZE(dcb_dcbx_flags); i++) { - struct dcb_dcbx_flag *flag = &dcb_dcbx_flags[i]; + const struct dcb_dcbx_flag *flag = &dcb_dcbx_flags[i]; if (flag->value == 1 << bit) { print_bool(PRINT_JSON, flag->key_json ?: flag->key_fp, @@ -123,7 +123,7 @@ static int dcb_cmd_dcbx_set(struct dcb *dcb, const char *dev, int argc, char **a } for (i = 0; i < ARRAY_SIZE(dcb_dcbx_flags); i++) { - struct dcb_dcbx_flag *flag = &dcb_dcbx_flags[i]; + const struct dcb_dcbx_flag *flag = &dcb_dcbx_flags[i]; if (matches(*argv, flag->key_fp) == 0) { dcbx |= flag->value; From patchwork Wed Jun 28 23:38:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13296431 X-Patchwork-Delegate: dsahern@gmail.com 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 422D011C8D for ; Wed, 28 Jun 2023 23:38:20 +0000 (UTC) Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1682C132 for ; Wed, 28 Jun 2023 16:38:19 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1b7f68f1c9eso830455ad.2 for ; Wed, 28 Jun 2023 16:38:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1687995498; x=1690587498; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/wdihvrzaNzfkenF/sT5C6HaVtdcbKpLpvWCmR3w9p0=; b=AsRVJ8IvduiV3hj/peoMROOMcxLoCRGsThOGogkB8unacNnc96346xlk0LfcZTuqOl HZt/LX2UMrVakHKcdRIOKv0k0ap/5JxZI9PttM4ZRrLJQ6Oo/YiEVwZmp85U1MmijiQ4 1tRAL2AJO/O/Ts3oOW/iTgiN9bSJ5VIHAph2o3v8AlpEYS9f7Meu540rGvbvREwMDz/A S5ILo/hrC/hlK03wY0TEvZNE6hczHyjS0xVELsuOohRDycTImBD0zk1ZkTwe+264Gg3l 1Xob3wVr14kg9hvLHGD15mFjqEWlcnEjCPwRmqX5nOIXcMhISEeUXqb0cT8b6LVE7ugj gFUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687995498; x=1690587498; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/wdihvrzaNzfkenF/sT5C6HaVtdcbKpLpvWCmR3w9p0=; b=fqUwO7dJ0JTGc6kUbQPHsoAGpJir0AfEufTjF3Fe7nGXfdMB52kqIwP+LDVGau9gGC myDtzNyVflO9w/9ugKml3WpgFQMsorDs+pI6KpTqmowQfAVAZlfi2s9NqrlCJcLr0hcd YT9Nhi63Qqi39frh5IDzMWhtB7bb1AMONIUS+bYiiSqNPS3tIRR3DAuoL4lFX267+8eF Cg6H58YFJb5LTGWSpDUAhfPUoKOAgfX61n0oH5LLjqS0Spa/pcV11hxKXfJNLBxE20BH Zf9nElDN3z9njDNfATgR5ALY/zOduM0ANVl8OYGCgWO60+YHKTH0DOhmx81PPL2nslXJ UiZA== X-Gm-Message-State: AC+VfDwxgL5rDlYvDC1/BZf5lEPEcba8EykVtafPWDuBGfyZg2tk9RE5 InVLEGb+Z6vg7Iw3sgzOOaIuQVqA5P+Tsps+Nrs1jw== X-Google-Smtp-Source: ACHHUZ48Dkps2meH2qyUxoU3vKeZ5BuidUQqoyF256KGS/g4J4f71FauKLYAqwrtRCQro0Nr5WdTrQ== X-Received: by 2002:a17:902:c951:b0:1b5:219a:cbbd with SMTP id i17-20020a170902c95100b001b5219acbbdmr16867272pla.3.1687995498414; Wed, 28 Jun 2023 16:38:18 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id s18-20020a170902a51200b001b7fb1a8200sm6437196plq.258.2023.06.28.16.38.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 16:38:17 -0700 (PDT) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2 2/5] fix fallthrough warnings Date: Wed, 28 Jun 2023 16:38:10 -0700 Message-Id: <20230628233813.6564-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230628233813.6564-1-stephen@networkplumber.org> References: <20230628233813.6564-1-stephen@networkplumber.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, 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: dsahern@gmail.com In lib/utils.c comment for fallthrough was in wrong place and one was missing in xfrm_state. Signed-off-by: Stephen Hemminger Reviewed-by: Petr Machata --- ip/xfrm_state.c | 1 + lib/utils.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c index a7b3d0e14156..9be65b2f8461 100644 --- a/ip/xfrm_state.c +++ b/ip/xfrm_state.c @@ -660,6 +660,7 @@ static int xfrm_state_modify(int cmd, unsigned int flags, int argc, char **argv) case XFRM_MODE_BEET: if (req.xsinfo.id.proto == IPPROTO_ESP) break; + /* fallthrough */ default: fprintf(stderr, "MODE value is invalid with XFRM-PROTO value \"%s\"\n", strxf_xfrmproto(req.xsinfo.id.proto)); diff --git a/lib/utils.c b/lib/utils.c index 01f3a5f7e4ea..b1f273054906 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -985,9 +985,8 @@ const char *rt_addr_n2a_r(int af, int len, return inet_ntop(AF_INET6, &sa->sin6.sin6_addr, buf, buflen); } - - /* fallthrough */ } + /* fallthrough */ default: return "???"; } From patchwork Wed Jun 28 23:38:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13296432 X-Patchwork-Delegate: dsahern@gmail.com 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 5628E125B2 for ; Wed, 28 Jun 2023 23:38:21 +0000 (UTC) Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 062E01BDF for ; Wed, 28 Jun 2023 16:38:20 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-55b1238cab4so60932a12.2 for ; Wed, 28 Jun 2023 16:38:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1687995499; x=1690587499; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=onEX/oRr9tY3MSi85RyuaTMSXEt3k1jsWtH3Fh4bBbY=; b=QkIULJzDlujxJfftUIBG5vS8SkYXV5tcdauvGRu3VbP4QtKL9DUsokzjcE2sDfhS3A 55NO2pIuA8ETVnaPL6O9BkCtv1YdbUQ+QsOWhu/vnxgab3yFdMq0hgDvEuUBPdpjHCZs b+2rde/TL309NfzFwnXbv30StHJYWxZZPubJd5mTiUwxebeyIvY0EDP0vYn2P/Bafefz Kz7KW6pK8MHzCpcs+n8tKhMlYBMeV2YAu87zaFS82O5HRAR3RySSfWSNTb4gGebw+Dxy Y+UCoLhjsRfdio20f9SIu/IwwXHj3MLO532xV4RnjdLOmm/jCGlzkIc31eRsLqXPyg69 CVag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687995499; x=1690587499; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=onEX/oRr9tY3MSi85RyuaTMSXEt3k1jsWtH3Fh4bBbY=; b=LLuIVrT+NhgG25CA6ZSwFdv0s+XS34oxtpGECvIpamOY1/MDlA7INNbAZ7S9Gu9xyo tUJ73dIXQoj1NOkrE37IhTPsvP+8IbtktVSgZbmkpXaWWk8Q1S2BtBjBQ5qQeUy3V69m qfBIsMSRqlZxOgefk5SF7hTqFTJGB2BoGb7rpvF5pJZPYkHkoh1uPQGkmtK6vgDpecey JIbWK4torrsLBTMDepSWA6vf2xof+VD/atw8WE5pfg2/LPyM8/bx6qMJwIkZ1rcbpRxR M3NfR7VxLhFdXo4yZrYGZk/HCnxUdrFFMJ1AI0UULRSd56hk0dw4+qe7ZOa5oBLYPowJ uh+Q== X-Gm-Message-State: AC+VfDz/Vm9/bgHoIzrpFgwuwA/+5WJ9xpQ2d2ou+jD0Tbj+3tXhohtm 5+DhDBE8ix0B3bk/QsaHOjFV7m3IJN/LDxOiGBtbsw== X-Google-Smtp-Source: ACHHUZ4MMEJ4P9B4XHA5cee67FoLi5ySnj2Wwa8MnvM0A5wIS8Wn5MZCARxXj7T7iOswoeQ+h/URsw== X-Received: by 2002:a17:902:d4c3:b0:1b6:771a:3516 with SMTP id o3-20020a170902d4c300b001b6771a3516mr12686126plg.22.1687995499128; Wed, 28 Jun 2023 16:38:19 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id s18-20020a170902a51200b001b7fb1a8200sm6437196plq.258.2023.06.28.16.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 16:38:18 -0700 (PDT) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2 3/5] ss: fix warning about empty if() Date: Wed, 28 Jun 2023 16:38:11 -0700 Message-Id: <20230628233813.6564-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230628233813.6564-1-stephen@networkplumber.org> References: <20230628233813.6564-1-stephen@networkplumber.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, 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: dsahern@gmail.com With all warnings enabled gcc wants brackets around the empty if() clause. "Yes I really want an empty clause" Signed-off-by: Stephen Hemminger Reviewed-by: Petr Machata --- misc/ss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/misc/ss.c b/misc/ss.c index de02fccb539b..e9d813596b91 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -627,8 +627,9 @@ static void user_ent_hash_build_task(char *path, int pid, int tid) fp = fopen(stat, "r"); if (fp) { - if (fscanf(fp, "%*d (%[^)])", task) < 1) + if (fscanf(fp, "%*d (%[^)])", task) < 1) { ; /* ignore */ + } fclose(fp); } } From patchwork Wed Jun 28 23:38:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13296433 X-Patchwork-Delegate: dsahern@gmail.com 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 3A3A2125B2 for ; Wed, 28 Jun 2023 23:38:22 +0000 (UTC) Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 120E6132 for ; Wed, 28 Jun 2023 16:38:21 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1b7e6512973so740585ad.3 for ; Wed, 28 Jun 2023 16:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1687995500; x=1690587500; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nPxDzV2U0MOwg+eeMRAAwSywoUmy+F8a1T+Z+8dx3g8=; b=mArH7AYssuifz4tpljmqlUJMxJTqnLR7Wfc0uFutrsVp5JqDq6pxMIwh+g/PKpc9Da 0KCkGyGwRpPFNbgCOY8ru5r7R34Hc5mbxuRpokGN1Wp5VGp4kwrwP46a38tLy1l/s/Dr 9g/1N56ArqYARZTLww/TfdXOYgAY76fmGC2gS3KOnJisyZGUXdQr4leTMRBYXCL9qfq9 JNq5RY0DB5FKizOBlRyjaXbp1woHODGY4hpusv6R6lxpDgKZYgV1KOv1jAzvm1tIzsPo g5SeVaPD+uxgAZPXwGuFP4SZyhhkmr7byZstc+LbPqpUd6bKf/dhVfFsCAtwcktKKdNk lGMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687995500; x=1690587500; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nPxDzV2U0MOwg+eeMRAAwSywoUmy+F8a1T+Z+8dx3g8=; b=L1oktPO0/ufx8Nu6NpGPPNS2GFvQgfo7rGb1dpZ7pMDP/jV4ZvwI/B776vyW3g9cMk waI4AQbOTtoMrv9JTptw1GXBBOPBbNAjNIyWpRz52bSJbzuhe9JU82L93GC1Ilk4jfs1 lJnSdnBtUoRsI3w6Sfd9pdEfH7SbrAJMMtBXusvyW3NjUys6IARIX/NkgqIBHz5zliw6 wjUnPDZMqmPlbCy8ADrT5NO0ezILnXw7D1PUWt69YJKQvecIy6/mEo3dKjpwrH/DvYCr CHTg7Mc+R2NeXO/YyS8+MLEbLSdxyCV2TIIbe+YSyn5Nb1x3rRlCEg7g9vEc5RZWRM6Z 6mrQ== X-Gm-Message-State: AC+VfDxzR7b9E0F5gKv/dk48Cpfim1rrBqT86RIGJZewPY1Io7TCZTN0 Pl2YIPIXbjFYBew0YyYNE3jdXssvRLjWq7JX8nhWbw== X-Google-Smtp-Source: ACHHUZ4hpzw6lDhH4nn4itYicOklFyc/g/ajDdlXNbJQJdK01SyTztafYGFDlovydCpFjJ9AkdIllw== X-Received: by 2002:a17:902:c40d:b0:1b5:5bf2:b7e2 with SMTP id k13-20020a170902c40d00b001b55bf2b7e2mr12244291plk.6.1687995500264; Wed, 28 Jun 2023 16:38:20 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id s18-20020a170902a51200b001b7fb1a8200sm6437196plq.258.2023.06.28.16.38.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 16:38:19 -0700 (PDT) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2 4/5] ct: check for invalid proto Date: Wed, 28 Jun 2023 16:38:12 -0700 Message-Id: <20230628233813.6564-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230628233813.6564-1-stephen@networkplumber.org> References: <20230628233813.6564-1-stephen@networkplumber.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, 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: dsahern@gmail.com Previously since proto was __u8 an invalid proto would be allowed. Gcc warns about never true conditional since __u8 can never be negative. Signed-off-by: Stephen Hemminger Reviewed-by: Petr Machata --- tc/m_ct.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tc/m_ct.c b/tc/m_ct.c index 3e2491b3d192..8c471489778a 100644 --- a/tc/m_ct.c +++ b/tc/m_ct.c @@ -161,7 +161,8 @@ static int ct_parse_mark(char *str, struct nlmsghdr *n) static int ct_parse_helper(char *str, struct nlmsghdr *n) { char f[32], p[32], name[32]; - __u8 family, proto; + __u8 family; + int proto; if (strlen(str) >= 32 || sscanf(str, "%[^-]-%[^-]-%[^-]", f, p, name) != 3) @@ -172,6 +173,7 @@ static int ct_parse_helper(char *str, struct nlmsghdr *n) family = AF_INET6; else return -1; + proto = inet_proto_a2n(p); if (proto < 0) return -1; From patchwork Wed Jun 28 23:38:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13296434 X-Patchwork-Delegate: dsahern@gmail.com 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 0A9AA125B2 for ; Wed, 28 Jun 2023 23:38:23 +0000 (UTC) Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 285111BDF for ; Wed, 28 Jun 2023 16:38:22 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-553a998bca3so67625a12.2 for ; Wed, 28 Jun 2023 16:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1687995501; x=1690587501; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=11GUKqOUe5mm/xH9kAyzUO3R487RfQnLA77IgHYuaOM=; b=WbA5yksJeKttZ1e1pCkiRnBsM2cQwHzUGpebW5WaUWJAQe6h/8894btRu+KIPQIG5P Vf7BMihDDLV9TaRmZQO34pzQfg2ivtEN7X6XMLlfZ/QPGMuSVja2Wbd5wMkaZy/qPy9j BwNFJC+Ui/ZqIRCa5ykLODiWLGNMP6Xbxkm5DGzTbKCAj7N3tIDHJMmrnSTIK2EmhkoH eKEHkOwFlOre8XxanweTHxacd8YXmZsGkS7xUHpOdTUtXW+S/MGPOPGxobLXvuI+5EZf 0ayFBjF4jrDgDkO+KWPcvCwe+LvCEOVcBkALAHtgZaUme1yQEdfBp1V5pZErl7a+qSGD 8X9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687995501; x=1690587501; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=11GUKqOUe5mm/xH9kAyzUO3R487RfQnLA77IgHYuaOM=; b=PGXljZ9QkZcze5DJ79qGKK0R2QkwkF7SpQaBfQ21fsIAvgyd/FtNGOKi/sG3mYh/yo rkojZbO2hqGgL5uISWMQ/Gv5EwVcRra33fp7mHc8IQRvDft0/iJxV6q8s930GDhIHL8L a7AihLG1nQROy6r/K0S9I3LSfyVBNO7N0zFc3wfiY8LNpSY2gJufNC0HhR4+Ebqnmgmp 8U4RBoisW7ijO9B0ZWTcGDpIdTb53jxoarcXKVYacW20qgQV9M19amhbBkrlwbugn61T 3L4fhDLawyYLp0Yo6sP9ZBMvkk2p8au8n8WOgGEBiKLl4a9RwSHO7E2srkS6ouy7vf/T NwgA== X-Gm-Message-State: AC+VfDwZQCTZQ3Mt8Hukw2dkgyMg9K+dfcbnZpdLC3XzPB0GdLE/q61i B00ZrVGp9K56bmu0eLDLfYdyAtd95/C80e0CkhZbHg== X-Google-Smtp-Source: ACHHUZ59CEdbxguXauJ43O0KPtbQ3CyLfDaSOV1JmWRHbwUTiQI8qHlfoyzGL6/ZZ1/KnE+DCYExUw== X-Received: by 2002:a17:902:e744:b0:1b6:6e3a:77fb with SMTP id p4-20020a170902e74400b001b66e3a77fbmr18325470plf.2.1687995501432; Wed, 28 Jun 2023 16:38:21 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id s18-20020a170902a51200b001b7fb1a8200sm6437196plq.258.2023.06.28.16.38.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 16:38:20 -0700 (PDT) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2 5/5] ifstat: fix warning about conditional Date: Wed, 28 Jun 2023 16:38:13 -0700 Message-Id: <20230628233813.6564-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230628233813.6564-1-stephen@networkplumber.org> References: <20230628233813.6564-1-stephen@networkplumber.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, 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: dsahern@gmail.com Gcc with warnings enabled complains because the conditional. if ((long)(a - b) < 0) could be construed as never true. Change to simple comparison. Signed-off-by: Stephen Hemminger Reviewed-by: Petr Machata --- misc/ifstat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/ifstat.c b/misc/ifstat.c index 4ce5ca8af4e7..f6f9ba5027d3 100644 --- a/misc/ifstat.c +++ b/misc/ifstat.c @@ -608,7 +608,7 @@ static void update_db(int interval) int i; for (i = 0; i < MAXS; i++) { - if ((long)(h1->ival[i] - n->ival[i]) < 0) { + if (h1->ival[i] < n->ival[i]) { memset(n->ival, 0, sizeof(n->ival)); break; }