From patchwork Mon Jan 17 17:50:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12715630 X-Patchwork-Delegate: dsahern@gmail.com 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 583E7C433EF for ; Mon, 17 Jan 2022 17:50:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230365AbiAQRu0 (ORCPT ); Mon, 17 Jan 2022 12:50:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241537AbiAQRuY (ORCPT ); Mon, 17 Jan 2022 12:50:24 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D208FC06161C for ; Mon, 17 Jan 2022 09:50:23 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id n8so8816089plc.3 for ; Mon, 17 Jan 2022 09:50:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UUg0KVM1F2nGgkcMTYO5rXPQ677Wz5yHiXolPtOt8ts=; b=hS+TTf5M5xjgFWI/tekFPoRn3Q5fTz6k1bv4aotlhKMBV2QgM1I+sNLpAGg0BejwRD azywjmWcIsBKx1FEJ4lME5bc9xdVw8sMxe99myj9FYbaVuoEgTNhCZiSxTgITTDtusKp +7v+n6IiZtkVBKGxQPCRy0LVg5lQfrO6BBEFug0s0tyjruqslPSUOeH9bUtcVWKHeih8 zjhUv6aRXb6ujlCn7c3Ny6k4y8PKIRn16069XzVUcgHjuwQuiRFWP45awJ73hWEfUkra 4jekAAlXP9BJnlvVnosrM76U001goVvMoPrGa2JI9ZGqySrROQqvuk7l+XteY4jh+83N P4Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UUg0KVM1F2nGgkcMTYO5rXPQ677Wz5yHiXolPtOt8ts=; b=NdOo/Wu4JVL1ou4al9zHbdTyNyIJUXr9UWBlBMPzrqjABjzzyiYDPY48EoyI2juAbC QwN7k8nh0+wUsRSiCkpJmA8QdI4evALmlf2Y98IzA3vJSlg9GsA3kdUh6BeI5p1mhM74 dlGlhErAO0XhwDDs135GQH1SO/+BaMFmeR4OOURqcpbW7dgYcnxRPEKLY4lVIWh1/v03 LM3Ngy0c/k4+XYMrtf+MXzL7sQ2J2O9zKL+Np2HvjozgFF/SzdnNGcUNqe/fphU4Raot Bbugk7kCjzQ+UELuvF6up0HhPSO4oh+sWFTXVlL7QHjWORmJA5LupLNEKtuVKickmyrd iEpQ== X-Gm-Message-State: AOAM530e0b/INiSR6O5esmydA5JI4PdjAv8JBulNDITWeDwTkiRjINTa Nm/CRo9EfaWMfm7oVS6/swqmMzXsOGmp+w== X-Google-Smtp-Source: ABdhPJxUcZ56cpDQljvCRkTzGSZeiS5Z/7x1Dai8Z+Po5IOHXrHC1XxVUY8R1qpelDlMD7+Rn4D90A== X-Received: by 2002:a17:902:ab16:b0:14a:912d:4502 with SMTP id ik22-20020a170902ab1600b0014a912d4502mr15557583plb.93.1642441823051; Mon, 17 Jan 2022 09:50:23 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q19sm15819117pfk.131.2022.01.17.09.50.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 09:50:22 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v3 iproute2-next 01/11] tc: add format attribute to tc_print_rate Date: Mon, 17 Jan 2022 09:50:09 -0800 Message-Id: <20220117175019.13993-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220117175019.13993-1-stephen@networkplumber.org> References: <20220117175019.13993-1-stephen@networkplumber.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com This catches future errors and silences warning from Clang. Signed-off-by: Stephen Hemminger --- tc/tc_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tc/tc_util.c b/tc/tc_util.c index 48065897cee7..6d5eb754831a 100644 --- a/tc/tc_util.c +++ b/tc/tc_util.c @@ -247,7 +247,8 @@ int get_percent_rate64(__u64 *rate, const char *str, const char *dev) return get_rate64(rate, r_str); } -void tc_print_rate(enum output_type t, const char *key, const char *fmt, +void __attribute__((format(printf, 3, 0))) +tc_print_rate(enum output_type t, const char *key, const char *fmt, unsigned long long rate) { print_rate(use_iec, t, key, fmt, rate); From patchwork Mon Jan 17 17:50:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12715631 X-Patchwork-Delegate: dsahern@gmail.com 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 098C2C4332F for ; Mon, 17 Jan 2022 17:50:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232953AbiAQRu1 (ORCPT ); Mon, 17 Jan 2022 12:50:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241566AbiAQRuZ (ORCPT ); Mon, 17 Jan 2022 12:50:25 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA08DC061574 for ; Mon, 17 Jan 2022 09:50:24 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id 59-20020a17090a09c100b001b34a13745eso30726815pjo.5 for ; Mon, 17 Jan 2022 09:50:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ORemWkIgIhYpjv2L/896OhU0cTQPr2PhxjAVl6VzpJo=; b=A20XI7fVO9myGhGqVsc09xbRKfykBjeDSLYwASBEmKQKEne7ApZQ+ggYa2uxfWH6jd XeZ1g5cD3fabJsLK7dZeJYFx0nJTKSPuNmiSe0LRmUfuqYkG2MnjRM+2pa584rkTJOpd p1c0hWN0TMk7LJvMbnccqJQATCkn8iIlAf2NPcJZDJ7Q8R53FeYjsK4F0LusMtzLMshz 4nJQR3zJ0QEqaC+cxfF+AdxuhkianrwMNa7JPR2kmE5TH6rCM1SCE23Jd/EFZrIo27V3 PzJlwNxaQWhUwDTHvY51c8/J1tsbQXe0jRTzvaPL8z/9T3Crqqn2XHVFwgudyB+xrDjj MFvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ORemWkIgIhYpjv2L/896OhU0cTQPr2PhxjAVl6VzpJo=; b=maF1+BDureeiRPtqH07ECmpPjV7U84HnWlf/ioQAvcnIW8Yst+qvsYoWvAwFruqFsW vr+3cNmwYqxfIO+YryMOVb/LkwVMxboLMtR7pqz6KXAOXHdJ4F785mGnVvRANifdvP6w 3B66mChc4YKqOiJLCTytRZ14AbSPP2AliMvU8R7huFCcKkYP4XaUpGz+x0b2dBeiTXFG k1VX6mijUxPoVwOdQovYCaeHJEYZPFA4pS/kDqMshh4B6eelDNvsoZu5jvoW5eNrwmfT /NAN7MVAR0K7oYOvXC+O/QODRohEnAmbMUzGlC2rbXe+DA6c5WSGY3Tk61kHKmCzIVWj 8SMQ== X-Gm-Message-State: AOAM531BSbozjyGcL+pujYDugclZlgpGovz2/auLowcgr+SUa5v53CqE m4wD9+qNq4YMnQy//9Lpl27Buflq+357GQ== X-Google-Smtp-Source: ABdhPJzIno6OcUUVrbeRNNckNEsPKwzun7tqDCjtgsaHJ9upWHlBSmK+o9tDYCh/CbWj1KbT8tiB8w== X-Received: by 2002:a17:902:82ca:b0:14a:bd99:5566 with SMTP id u10-20020a17090282ca00b0014abd995566mr5475347plz.41.1642441824007; Mon, 17 Jan 2022 09:50:24 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q19sm15819117pfk.131.2022.01.17.09.50.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 09:50:23 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v3 iproute2-next 02/11] utils: add format attribute Date: Mon, 17 Jan 2022 09:50:10 -0800 Message-Id: <20220117175019.13993-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220117175019.13993-1-stephen@networkplumber.org> References: <20220117175019.13993-1-stephen@networkplumber.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com One more format attribute needed to resolve clang warnings. Signed-off-by: Stephen Hemminger --- include/utils.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/utils.h b/include/utils.h index b6c468e9cc86..d644202cc529 100644 --- a/include/utils.h +++ b/include/utils.h @@ -261,7 +261,9 @@ int print_timestamp(FILE *fp); void print_nlmsg_timestamp(FILE *fp, const struct nlmsghdr *n); unsigned int print_name_and_link(const char *fmt, - const char *name, struct rtattr *tb[]); + const char *name, struct rtattr *tb[]) + __attribute__((format(printf, 1, 0))); + #define BIT(nr) (UINT64_C(1) << (nr)) From patchwork Mon Jan 17 17:50:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12715634 X-Patchwork-Delegate: dsahern@gmail.com 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 53812C433EF for ; Mon, 17 Jan 2022 17:50:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241415AbiAQRu3 (ORCPT ); Mon, 17 Jan 2022 12:50:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229644AbiAQRuZ (ORCPT ); Mon, 17 Jan 2022 12:50:25 -0500 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1760C061574 for ; Mon, 17 Jan 2022 09:50:25 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id i65so10830938pfc.9 for ; Mon, 17 Jan 2022 09:50:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PLrtaU0fxXFhqRXeT0Jx0z02127t5xnDBA04neCpsbE=; b=FA8BHYw+OIpAhPIG+zm2oULZ9ihOM/LEyoQ1w1A/2N9Hj4QL02Enk9yGIdcblIN0bc GMCQ0nNCW7UOeRpNlT8nN4Vl4Rllfd1TfFhH2NiDUoetjQEIkwaNo9NiQxozSuMeD3sC BM8uNetf+AnxHjrmZiXOCNl9/OHuRf1HY62WdOWSpwkRC1nT89c+TFF7eQRsCkZzs2+i 0eMM1nzyKz4QnXFlTHIQSi1lR7Wd/qIw/pa9HsKJfnSOUyM/TqW8tW5liw+pJJH68vBu PFyJsqXbxv5Og8ilmR1xaXgryg+0MLA4nzj2G95aYiCzfsuEywy7hO7YRiKPskynaOoD D0Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PLrtaU0fxXFhqRXeT0Jx0z02127t5xnDBA04neCpsbE=; b=h7dz3jsrSfFS0hj17RVaDRen+IYByb75nAHlno0VMCIBSauWvA9lN2uvrqdqMkvEga +nWtwmQMaCNvJSEFYkpUuwlnPQaj3m0RtX7YSv80T/moMdjWQ4FM4CMmJxdEtSV/aOJX rV0Avx9xfPp+g8fiYPXYeDmLQgWbCs7nQIt0uUrzakMxNVmanG9FssX9wkShSb7A3bzP qL6gle97XeT1ZvfFLF3OwUuUerVzdBQ6u5q2ivrPjY2G1uz7Lai3jWqLjPx9LE2UoPic 4nwBgblJdszrNfhXwJO71kghIBM+jtXanMsVzKbv8ck1tJaF8nnqUgGtUHHqtwM+XIEX Ea/A== X-Gm-Message-State: AOAM532OX2KXNAbdvtWZ8ZV0t9PSsaPg/t3eA7W9mwXa0lJvNDHJ1/9J wUw7VL7y8IZTwb/gQfgNqPNHW7uDsnOG4A== X-Google-Smtp-Source: ABdhPJwpuETKyKNZfke18FN9X4RiRTLGp6HGTKrwziKwvsx4bg1DQASPeG69Cl/QaBB+HpvQzDbqbw== X-Received: by 2002:a63:7f59:: with SMTP id p25mr19965113pgn.612.1642441824941; Mon, 17 Jan 2022 09:50:24 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q19sm15819117pfk.131.2022.01.17.09.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 09:50:24 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v3 iproute2-next 03/11] netem: fix clang warnings Date: Mon, 17 Jan 2022 09:50:11 -0800 Message-Id: <20220117175019.13993-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220117175019.13993-1-stephen@networkplumber.org> References: <20220117175019.13993-1-stephen@networkplumber.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com Netem is using empty format string to not print values. Clang complains about this hack so don't do it. Signed-off-by: Stephen Hemminger --- tc/q_netem.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/tc/q_netem.c b/tc/q_netem.c index 2e5a46ab7b25..c483386894ea 100644 --- a/tc/q_netem.c +++ b/tc/q_netem.c @@ -59,10 +59,12 @@ static void explain1(const char *arg) #define MAX_DIST (16*1024) /* Print values only if they are non-zero */ -static void __print_int_opt(const char *label_json, const char *label_fp, - int val) +static void __attribute__((format(printf, 2, 0))) +__print_int_opt(const char *label_json, const char *label_fp, int val) { - print_int(PRINT_ANY, label_json, val ? label_fp : "", val); + print_int(PRINT_JSON, label_json, NULL, val); + if (val != 0) + print_int(PRINT_FP, NULL, label_fp, val); } #define PRINT_INT_OPT(label, val) \ __print_int_opt(label, " " label " %d", (val)) @@ -70,8 +72,8 @@ static void __print_int_opt(const char *label_json, const char *label_fp, /* Time print prints normally with varying units, but for JSON prints * in seconds (1ms vs 0.001). */ -static void __print_time64(const char *label_json, const char *label_fp, - __u64 val) +static void __attribute__((format(printf, 2, 0))) +__print_time64(const char *label_json, const char *label_fp, __u64 val) { SPRINT_BUF(b1); @@ -85,8 +87,8 @@ static void __print_time64(const char *label_json, const char *label_fp, /* Percent print prints normally in percentage points, but for JSON prints * an absolute value (1% vs 0.01). */ -static void __print_percent(const char *label_json, const char *label_fp, - __u32 per) +static void __attribute__((format(printf, 2, 0))) +__print_percent(const char *label_json, const char *label_fp, __u32 per) { print_float(PRINT_FP, NULL, label_fp, (100. * per) / UINT32_MAX); print_float(PRINT_JSON, label_json, NULL, (1. * per) / UINT32_MAX); @@ -802,9 +804,10 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) rate64 = rate64 ? : rate->rate; tc_print_rate(PRINT_ANY, "rate", " rate %s", rate64); PRINT_INT_OPT("packetoverhead", rate->packet_overhead); - print_uint(PRINT_ANY, "cellsize", - rate->cell_size ? " cellsize %u" : "", - rate->cell_size); + + print_uint(PRINT_JSON, "cellsize", NULL, rate->cell_size); + if (rate->cell_size) + print_uint(PRINT_FP, NULL, " cellsize %u", rate->cell_size); PRINT_INT_OPT("celloverhead", rate->cell_overhead); close_json_object(); } @@ -824,9 +827,13 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) close_json_object(); } - print_bool(PRINT_ANY, "ecn", ecn ? " ecn " : "", ecn); - print_luint(PRINT_ANY, "gap", qopt.gap ? " gap %lu" : "", - (unsigned long)qopt.gap); + print_bool(PRINT_JSON, "ecn", NULL, ecn); + if (ecn) + print_bool(PRINT_FP, NULL, " ecn ", ecn); + + print_luint(PRINT_JSON, "gap", NULL, qopt.gap); + if (qopt.gap) + print_luint(PRINT_FP, NULL, " gap %lu", qopt.gap); return 0; } From patchwork Mon Jan 17 17:50:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12715632 X-Patchwork-Delegate: dsahern@gmail.com 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 82059C433F5 for ; Mon, 17 Jan 2022 17:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233022AbiAQRu2 (ORCPT ); Mon, 17 Jan 2022 12:50:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232714AbiAQRu0 (ORCPT ); Mon, 17 Jan 2022 12:50:26 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92332C06173E for ; Mon, 17 Jan 2022 09:50:26 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id ie23-20020a17090b401700b001b38a5318easo478853pjb.2 for ; Mon, 17 Jan 2022 09:50:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jqvz2LGyE7knId3mboqOpZqiWxGHqUhxacItbVAXPoM=; b=BL5jOI0uw4ovRmkPOXSMn6yCBlZJbPwTeybuqgkwlzzYL+fLh7UJwYKPUTL1C6CUBm gCleIB70Cd9ueSQT1Jx/h+J0ToDK/wHK/1gLVqH9BYrlenA/xf/McNnHxr1mUE/NL6YM NeO/4QBa1Y4RENC55vklwqHZ/MjRiIh9KGjPDD8SVL8sFEyEYPCvth84ZaNaW2ieB2CQ vXKNP3rNtL02gZbhbs01Wgtua1jADOAyyB0R/cP4phLuKkv1V8Qci0mITVwBlNdKf4fT 9cWA57BMB114S8OiCTpIoeHmygPJN3qCthpD+QCTKSfQR/OE8CIKbqsxneQhHPyzVpGK Iu6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jqvz2LGyE7knId3mboqOpZqiWxGHqUhxacItbVAXPoM=; b=zJnuvrugUEcy3imhFjVa45AOlt+6mztOjwDkfudV9SphHQHjee5IIO3EbhcMVXQCRv C+pnaolEAWnRkgja5n3pGl+FdRNmZzmT+4ocvsQ+sxxdcdGz1h4+AtkNQupGOM9TOHOo fOudg/F0J2Cw1TpeO3t7yU0Gw/9dvBPA3jBupzJxB4N6CSE7+7xVjKQ1ELD+ZkBP49NU MQJL/uAo223zAny0PQFI2UooQCeGYvu7melYwpDyVgEnwpC79Z4jGpI4Tmt0OVNpdhbD uAO2VY6hoxVZ7nYzvimSx99x3YjB8nubEHfd7CEp+7B84nZshJ7oWPNUTpbmEKp6z5Qu Nu5Q== X-Gm-Message-State: AOAM532BJzTNbje8Qa886yWBIMhMFLJfAfirlxSwDDDVSuYff8VMqltO 82ujxlr4SlYTuXLuaoVr/vieFzx++BSmqQ== X-Google-Smtp-Source: ABdhPJwOtH8AK9cftf8bbjGegjqJj741fdCsmwoWL7M2WW9khyxEPBobzSlxnmI/L6y5r34UgZbsKg== X-Received: by 2002:a17:902:cacb:b0:14a:c2ac:5216 with SMTP id y11-20020a170902cacb00b0014ac2ac5216mr4028683pld.163.1642441825812; Mon, 17 Jan 2022 09:50:25 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q19sm15819117pfk.131.2022.01.17.09.50.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 09:50:25 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v3 iproute2-next 04/11] flower: fix clang warnings Date: Mon, 17 Jan 2022 09:50:12 -0800 Message-Id: <20220117175019.13993-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220117175019.13993-1-stephen@networkplumber.org> References: <20220117175019.13993-1-stephen@networkplumber.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com Clang complains about passing non-format string to print_string. Handle this by splitting json and non-json parts. Signed-off-by: Stephen Hemminger --- tc/f_flower.c | 49 ++++++++++++++++++------------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/tc/f_flower.c b/tc/f_flower.c index 6d70b92a2894..f4dd2ce194c4 100644 --- a/tc/f_flower.c +++ b/tc/f_flower.c @@ -102,6 +102,12 @@ static void explain(void) " to specify different mask, he has to use different prio.\n"); } +static void print_indent_name_value(const char *name, const char *value) +{ + print_string(PRINT_FP, NULL, "%s ", _SL_); + print_string_name_value(name, value); +} + static int flower_parse_eth_addr(char *str, int addr_type, int mask_type, struct nlmsghdr *n) { @@ -1925,10 +1931,9 @@ static int __mask_bits(char *addr, size_t len) return bits; } -static void flower_print_eth_addr(char *name, struct rtattr *addr_attr, +static void flower_print_eth_addr(const char *name, struct rtattr *addr_attr, struct rtattr *mask_attr) { - SPRINT_BUF(namefrm); SPRINT_BUF(out); SPRINT_BUF(b1); size_t done; @@ -1949,9 +1954,7 @@ static void flower_print_eth_addr(char *name, struct rtattr *addr_attr, sprintf(out + done, "/%d", bits); } - print_nl(); - sprintf(namefrm, " %s %%s", name); - print_string(PRINT_ANY, name, namefrm, out); + print_indent_name_value(name, out); } static void flower_print_eth_type(__be16 *p_eth_type, @@ -2064,7 +2067,6 @@ static void flower_print_ip_addr(char *name, __be16 eth_type, { struct rtattr *addr_attr; struct rtattr *mask_attr; - SPRINT_BUF(namefrm); SPRINT_BUF(out); size_t done; int family; @@ -2095,10 +2097,9 @@ static void flower_print_ip_addr(char *name, __be16 eth_type, else if (bits < len * 8) sprintf(out + done, "/%d", bits); - print_nl(); - sprintf(namefrm, " %s %%s", name); - print_string(PRINT_ANY, name, namefrm, out); + print_indent_name_value(name, out); } + static void flower_print_ip4_addr(char *name, struct rtattr *addr_attr, struct rtattr *mask_attr) { @@ -2124,22 +2125,18 @@ static void flower_print_port_range(char *name, struct rtattr *min_attr, print_hu(PRINT_JSON, "end", NULL, rta_getattr_be16(max_attr)); close_json_object(); } else { - SPRINT_BUF(namefrm); SPRINT_BUF(out); size_t done; done = sprintf(out, "%u", rta_getattr_be16(min_attr)); sprintf(out + done, "-%u", rta_getattr_be16(max_attr)); - print_nl(); - sprintf(namefrm, " %s %%s", name); - print_string(PRINT_ANY, name, namefrm, out); + print_indent_name_value(name, out); } } static void flower_print_tcp_flags(const char *name, struct rtattr *flags_attr, struct rtattr *mask_attr) { - SPRINT_BUF(namefrm); SPRINT_BUF(out); size_t done; @@ -2150,9 +2147,7 @@ static void flower_print_tcp_flags(const char *name, struct rtattr *flags_attr, if (mask_attr) sprintf(out + done, "/%x", rta_getattr_be16(mask_attr)); - print_nl(); - sprintf(namefrm, " %s %%s", name); - print_string(PRINT_ANY, name, namefrm, out); + print_indent_name_value(name, out); } static void flower_print_ct_state(struct rtattr *flags_attr, @@ -2239,14 +2234,11 @@ static void flower_print_ct_mark(struct rtattr *attr, static void flower_print_key_id(const char *name, struct rtattr *attr) { - SPRINT_BUF(namefrm); - if (!attr) return; print_nl(); - sprintf(namefrm, " %s %%u", name); - print_uint(PRINT_ANY, name, namefrm, rta_getattr_be32(attr)); + print_uint_name_value(name, rta_getattr_be32(attr)); } static void flower_print_geneve_opts(const char *name, struct rtattr *attr, @@ -2342,8 +2334,9 @@ static void flower_print_erspan_opts(const char *name, struct rtattr *attr, sprintf(strbuf, "%u:%u:%u:%u", ver, idx, dir, hwid); } -static void flower_print_enc_parts(const char *name, const char *namefrm, - struct rtattr *attr, char *key, char *mask) +static void __attribute__((format(printf, 2, 0))) +flower_print_enc_parts(const char *name, const char *namefrm, + struct rtattr *attr, char *key, char *mask) { char *key_token, *mask_token, *out; int len; @@ -2431,7 +2424,6 @@ static void flower_print_masked_u8(const char *name, struct rtattr *attr, { const char *value_str = NULL; __u8 value, mask; - SPRINT_BUF(namefrm); SPRINT_BUF(out); size_t done; @@ -2451,9 +2443,7 @@ static void flower_print_masked_u8(const char *name, struct rtattr *attr, if (mask != UINT8_MAX) sprintf(out + done, "/%d", mask); - print_nl(); - sprintf(namefrm, " %s %%s", name); - print_string(PRINT_ANY, name, namefrm, out); + print_indent_name_value(name, out); } static void flower_print_u8(const char *name, struct rtattr *attr) @@ -2463,14 +2453,11 @@ static void flower_print_u8(const char *name, struct rtattr *attr) static void flower_print_u32(const char *name, struct rtattr *attr) { - SPRINT_BUF(namefrm); - if (!attr) return; print_nl(); - sprintf(namefrm, " %s %%u", name); - print_uint(PRINT_ANY, name, namefrm, rta_getattr_u32(attr)); + print_uint_name_value(name, rta_getattr_u32(attr)); } static void flower_print_mpls_opt_lse(struct rtattr *lse) From patchwork Mon Jan 17 17:50:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12715633 X-Patchwork-Delegate: dsahern@gmail.com 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 633D0C433FE for ; Mon, 17 Jan 2022 17:50:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229644AbiAQRua (ORCPT ); Mon, 17 Jan 2022 12:50:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233221AbiAQRu1 (ORCPT ); Mon, 17 Jan 2022 12:50:27 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89A64C06173F for ; Mon, 17 Jan 2022 09:50:27 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id x83so11534572pgx.4 for ; Mon, 17 Jan 2022 09:50:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iEgjwO21tklJU+rA01ZKNx+SZWk9A5aVEz+AGzdHYvI=; b=fK7Um/ANqMdjWCUCOlSlg3CFo9/bV6ObC+d5vK/HGT+QXlwlCgAoeF/jgmO1op9GVJ 0hh78YQZuWeET7bIFlEMdHW7N84We+Pmh9QcL//M7OvDtgcEoe9RzY2xEPpXwlMVi2y9 JlQtMFUQ7KzFv4XhsgAEu4pSMynSZZigWUbdA44Mtj7LNEFfUDaBfVPWwFCh8BsZzPEL LtFj/zNB7uebd5+ohCCOu+Yowppb4tr18v/43dZeemn9VH30wZu15QFJyfVQMyHUb1ub UTPo7AVtBcT9MBfsgpEM5iUf5eOU0/3vejtmUlkXZPwZ3clKEFcznC2F19ffhd71gr8W EtJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iEgjwO21tklJU+rA01ZKNx+SZWk9A5aVEz+AGzdHYvI=; b=VvuvYIbHLaHaUAj6XxHRE52V1ePnySaPFRthXQVE2eR1hTKHvjC+9PJVUYISWE/OhX 5+Z7msvFXvV7n0I9gXxE1UV/3beENxq2lmWGD669zqKBlp/Hw/EvH7CQ9Mxo+UuGpBvR GHbiz2qjurVk05CTayhVQ/X5VGNffds22+dnEvsm0yO7i+SMOxGs4Y9MIzvO4j5q2yur e8V74ziedNYsVTIWEqSR5WwQ1oAA3yh0qwDnKD+hn/0UQR0DOeG+dEvyPe4NwmkQHrYk qoOJVCqLKgme9No3vOutytuB1ei+t23TnCW05OnZSq5kV6jZbCZekjrS9SB7kQLWLvSN 9vtQ== X-Gm-Message-State: AOAM531M3qnAMuS/FE10zY5aJ1qJsn+m8l1/ok1ISNXfaCvBVza2SZ8S Amr+kts6XqXwbX9K4jzJ6wXED4xuDF7P3A== X-Google-Smtp-Source: ABdhPJxkdd3edydZhJm/0p/7OPC/GPDNgVUrfKcmuyYpKhwsZc0ifhOrhjrBKG38cQJCLQeN0+HIRQ== X-Received: by 2002:a63:b24b:: with SMTP id t11mr19827037pgo.444.1642441826766; Mon, 17 Jan 2022 09:50:26 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q19sm15819117pfk.131.2022.01.17.09.50.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 09:50:26 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , elibr@mellanox.com Subject: [PATCH v3 iproute2-next 05/11] tc_util: fix clang warning in print_masked_type Date: Mon, 17 Jan 2022 09:50:13 -0800 Message-Id: <20220117175019.13993-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220117175019.13993-1-stephen@networkplumber.org> References: <20220117175019.13993-1-stephen@networkplumber.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com Clang complains about passing a non-format string but the code here was doing extra work the JSON case. Using print_uint_name_value here makes the code much simpler. Old code was also broken if using oneline mode. Fixes: 04b215015ba8 ("tc_util: introduce a function to print JSON/non-JSON masked numbers") Cc: elibr@mellanox.com Signed-off-by: Stephen Hemminger --- tc/tc_util.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/tc/tc_util.c b/tc/tc_util.c index 6d5eb754831a..cdc3451cdc09 100644 --- a/tc/tc_util.c +++ b/tc/tc_util.c @@ -783,10 +783,7 @@ static void print_masked_type(__u32 type_max, const char *name, struct rtattr *attr, struct rtattr *mask_attr, bool newline) { - SPRINT_BUF(namefrm); __u32 value, mask; - SPRINT_BUF(out); - size_t done; if (!attr) return; @@ -794,27 +791,14 @@ static void print_masked_type(__u32 type_max, value = rta_getattr_type(attr); mask = mask_attr ? rta_getattr_type(mask_attr) : type_max; - if (is_json_context()) { - sprintf(namefrm, "\n %s %%u", name); - print_hu(PRINT_ANY, name, namefrm, - rta_getattr_type(attr)); - if (mask != type_max) { - char mask_name[SPRINT_BSIZE-6]; - - sprintf(mask_name, "%s_mask", name); - if (newline) - print_string(PRINT_FP, NULL, "%s ", _SL_); - sprintf(namefrm, " %s %%u", mask_name); - print_hu(PRINT_ANY, mask_name, namefrm, mask); - } - } else { - done = sprintf(out, "%u", value); - if (mask != type_max) - sprintf(out + done, "/0x%x", mask); - if (newline) - print_string(PRINT_FP, NULL, "%s ", _SL_); - sprintf(namefrm, " %s %%s", name); - print_string(PRINT_ANY, name, namefrm, out); + print_string(PRINT_FP, NULL, "%s ", _SL_); + print_uint_name_value(name, value); + + if (mask != type_max) { + char mask_name[SPRINT_BSIZE-6]; + + snprintf(mask_name, sizeof(mask_name), "%s_mask", name); + print_hex(PRINT_ANY, mask_name, "/0x%x", mask); } } From patchwork Mon Jan 17 17:50:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12715635 X-Patchwork-Delegate: dsahern@gmail.com 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 3FF40C433F5 for ; Mon, 17 Jan 2022 17:50:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241921AbiAQRud (ORCPT ); Mon, 17 Jan 2022 12:50:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241665AbiAQRu2 (ORCPT ); Mon, 17 Jan 2022 12:50:28 -0500 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 739DBC061574 for ; Mon, 17 Jan 2022 09:50:28 -0800 (PST) Received: by mail-pg1-x533.google.com with SMTP id q75so3821488pgq.5 for ; Mon, 17 Jan 2022 09:50:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2CmMkcLMupEBjGGLQZwEV/RJ8zBm1D0fwzw031sSOqU=; b=Fthz7WL3hybo1kkw2Ta6oTHsIZzfCuqiT3ilS7JT7g/YqsJsaNa0IwnlYs2ejHymzt RkLfGSMkP7meM2Qvljyv0yaqMlN6PWsbGSC5W4Q4ppHMQbFYLbmH10sEFYNKe7E3t63u LvFiDAMegOeOS2YFLZdCCh2tfx3IGalmmJDciCJT2KtqcJyLb4uNZyqx1TdetKtxWIJG psJFkZF7tjbh5ndk+ffxO6dDPlD2j3dBe/Muxl1VLPKlk+oKVSnocZ+wZVBaG+ra28yu 3qsC3D0Djv0nbf45kEuhhRMyt9hhm3hSxW9B1vL0N9IRwa5TSJjlMPHXdK0ObqaYvWwt w3vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2CmMkcLMupEBjGGLQZwEV/RJ8zBm1D0fwzw031sSOqU=; b=wk6uTMo+dSldDd5T7PqHuqcZT7ASl1+6iMFGwBXzz9nOJdXGcpwWjNiB21dSlMFq2O 23ujR/eR3+YOwPu09knGPyjVLLFETS6Sg57twoPII7hHpgXE1CfShVQZx1YS3IGAF3nG DlLYUmG0vFe0fFtnQgJKtTPk/hnohLDHnWOuO+xpweQzH0ZpzdYYVOAS9AHYnLjHheCN J/FgBZs6A+MOzHcupuQP4NEIWB0TnIvIjDfexnN8jM7+JSxFZjWDmVcGt97+ISceYCd2 NQuZ31V5raPZF6n2cqYn6qxf7TeMvXKFnBBXxw+rw6+t6c5Uoln03LTy+ZZHq5huceUv V8CQ== X-Gm-Message-State: AOAM533EgcnBc/JNAzIt3t18Imd/ADUR+nlJJXarFK+EaYyh3GC2HjDK dYvtoepXvkBlGwPAl6y+Bzkjc7zz7TTuNA== X-Google-Smtp-Source: ABdhPJwDG5OeakU4dq3LeqZh2fa61Go051YZFkjvyycrvipTGCdjWC4GSVepXWX8Z3vjfZPnlL+s5Q== X-Received: by 2002:a63:154f:: with SMTP id 15mr19647545pgv.521.1642441827719; Mon, 17 Jan 2022 09:50:27 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q19sm15819117pfk.131.2022.01.17.09.50.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 09:50:27 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v3 iproute2-next 06/11] ipl2tp: fix clang warning Date: Mon, 17 Jan 2022 09:50:14 -0800 Message-Id: <20220117175019.13993-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220117175019.13993-1-stephen@networkplumber.org> References: <20220117175019.13993-1-stephen@networkplumber.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com Clang complains about passing non-format string. Signed-off-by: Stephen Hemminger --- ip/ipl2tp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c index 77bc3249c7ec..569723581ec2 100644 --- a/ip/ipl2tp.c +++ b/ip/ipl2tp.c @@ -191,8 +191,9 @@ static int delete_session(struct l2tp_parm *p) return 0; } -static void print_cookie(const char *name, const char *fmt, - const uint8_t *cookie, int len) +static void __attribute__((format(printf, 2, 0))) +print_cookie(const char *name, const char *fmt, + const uint8_t *cookie, int len) { char abuf[32]; size_t n; From patchwork Mon Jan 17 17:50:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12715636 X-Patchwork-Delegate: dsahern@gmail.com 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 9DE6DC4332F for ; Mon, 17 Jan 2022 17:50:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242003AbiAQRue (ORCPT ); Mon, 17 Jan 2022 12:50:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241684AbiAQRu3 (ORCPT ); Mon, 17 Jan 2022 12:50:29 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53B6DC06161C for ; Mon, 17 Jan 2022 09:50:29 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id b1-20020a17090a990100b001b14bd47532so509461pjp.0 for ; Mon, 17 Jan 2022 09:50:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6Lu8Ofe9OiOomvfdmKceVGmq8zIVB6BYh6XUCUGTXdg=; b=3FJoKOfor8mP8CaX+K//wMKJFZGvy/niBeVbaL8O3HCr90LGdFcCWj4SDoGkF1Oj9L AEd8cI7k3vdiBv+/zTFWKhqimFo8U9c/RBJsKdGJYFauLOaHDC3f+q44QXPPuSf5aXUW 7uDz7NiCMGO/Kov9+8rgWnDTjo331b+yuJhRGugafuYFhX6p1hQOM66qGUj80KOjKekK AYzTDq/Tc5xymLKpyoRt5QIQJycrsf4u5FDLC3bx8GGnvJArGmADHCZlr/mXcl4nysF7 AfXGhW9PdvZTK6W+B1akP5BhJcJqHJHoW8SGinFQil4tDzFS0tMWWd57mdtOa8YGM+ty ldKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6Lu8Ofe9OiOomvfdmKceVGmq8zIVB6BYh6XUCUGTXdg=; b=n+0T6vLrHe84r++FXCTF/u/Uau8glNJyrtV2RJtNENBJ9P29DKx36SMt7ZdrjUiLsH /TUS3Y6snaNHagwTAGSsaAzPffM9/6yr4RGEw4lOOOAaivCtrli53JnjhXKIpzpP7cgV dCmgr4oW98F2dN/Yv9ssShH+hntETxmukLMemNV5IO6PnyaF+hCRSF+9qF9mAvvGqcso qfzPBkYJgiOX7/V8Kd7PFSDCTXFOFGRrAJlShpoqwAqQLE2C/knpTTEGuUMCOVWEZD5U qh02PnpV4MlpxPrGqOaLMCbys32UqdEYI/MrFeNKLHH4P+FJiuMm0LTI33jZz3j1vynI Y34w== X-Gm-Message-State: AOAM533mBa41+xy1WdhCk2p5flvHVQAdb0oq6utsXeyxBBwluOEstmCY 4hrMj/whv1KC0c94wsCB69bJq9uwVHPutw== X-Google-Smtp-Source: ABdhPJwVVTYJaqLzikqxbUYiqyTRpzw6MlTKEl4cr9XEV9XW4f7eLs+3B+RnqUDNJVsmT5f1I8gP7w== X-Received: by 2002:a17:902:6bcc:b0:14a:bd99:1ae9 with SMTP id m12-20020a1709026bcc00b0014abd991ae9mr5355096plt.62.1642441828577; Mon, 17 Jan 2022 09:50:28 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q19sm15819117pfk.131.2022.01.17.09.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 09:50:28 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v3 iproute2-next 07/11] can: fix clang warning Date: Mon, 17 Jan 2022 09:50:15 -0800 Message-Id: <20220117175019.13993-8-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220117175019.13993-1-stephen@networkplumber.org> References: <20220117175019.13993-1-stephen@networkplumber.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com Fix warning about passing non-format string. Signed-off-by: Stephen Hemminger --- ip/iplink_can.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index 854ccc314e2b..6ea02a2a51c4 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -330,8 +330,9 @@ static void can_print_nl_indent(void) print_string(PRINT_FP, NULL, "%s", "\t "); } -static void can_print_timing_min_max(const char *json_attr, const char *fp_attr, - int min, int max) +static void __attribute__((format(printf, 2, 0))) +can_print_timing_min_max(const char *json_attr, const char *fp_attr, + int min, int max) { print_null(PRINT_FP, NULL, fp_attr, NULL); open_json_object(json_attr); From patchwork Mon Jan 17 17:50:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12715637 X-Patchwork-Delegate: dsahern@gmail.com 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 E0331C43217 for ; Mon, 17 Jan 2022 17:50:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241684AbiAQRuf (ORCPT ); Mon, 17 Jan 2022 12:50:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241860AbiAQRua (ORCPT ); Mon, 17 Jan 2022 12:50:30 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C97CC061747 for ; Mon, 17 Jan 2022 09:50:30 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id d10-20020a17090a498a00b001b33bc40d01so196609pjh.1 for ; Mon, 17 Jan 2022 09:50:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=74kcV1kq3XqBCswjyh0NmJxjkLOaCkow0LnYZQJp7Ng=; b=LDGATO42NpM9zpiTOiW/lKKoI0saJ8EGgRbb88Kykcu+7AW4v03gP1a28CdX8JuXbP rK53TnYikYzME8+WEBIe+MdhXIWONMmSmh+K6HGxJ27zMQ2eFh0Y8KaqamcWUlb+f8+6 hwjvkqrkK0U3FUuu6H6phavqmjvMrgTdPhQwt6t+QEyBsCB/DmPVzOOir0p2/0SC7sa+ 5/UwB011YG/QJfxLP4R6yXHCNBi9zehhWxL5HySld1HPeMhrd42EWE9KbzCMuOoWFSsl c6cHxz+a5hxjFULN3v6tA8Nf1zdq4LKGvHC+iNy0Hpe4LKnkSkOpj7J8sVyxVk6+ixGe /08Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=74kcV1kq3XqBCswjyh0NmJxjkLOaCkow0LnYZQJp7Ng=; b=eZN1i/O/4iKGkeTd36N4mvY7CoBvUe5mVVWUpdvC4g9CMOklLRXpe18lUM7WDJuuCu CpSD22Gj0IMsAjqJzPUbhDYsncG8ry0aeQ7JbLmBYJWWiN/QIF6eqwUEhxSuj4LWLGsF 4fWWPRQTDCqryhGrTybli6GQ2PPciYQyw6VmE9jQw8XGTIvxQWcrCApiZojNiAZCXlnP /JUpnUKynBJCHTG20qwm9aIsfjIChYMlbucASd2Fx0JbtPsxvFjYSE/gNAmPft0UcHi8 2MsJIpSlJfLr1j/1oSerfdz/iMEVCoZ7kqW78c4zygQnIYCAmUH40+dRj+zX7SMjtw47 cB1A== X-Gm-Message-State: AOAM530BlTJcnz7ekO3nDrE9zX26w+yjW/z2AmGQ13eKCe9GWNsS5w/j zWuSC+Qapm6nKVMOI52N3e1Sc1irMZaBLQ== X-Google-Smtp-Source: ABdhPJxakXOpdBkR+OyWpsD9spqRM4o9MFcUmUmsYzRYxz1j5azsUqe9CZRJM9NXrINnpeXHYxB9bw== X-Received: by 2002:a17:902:6acc:b0:149:7087:3564 with SMTP id i12-20020a1709026acc00b0014970873564mr23814799plt.168.1642441829487; Mon, 17 Jan 2022 09:50:29 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q19sm15819117pfk.131.2022.01.17.09.50.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 09:50:28 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v3 iproute2-next 08/11] tipc: fix clang warning about empty format string Date: Mon, 17 Jan 2022 09:50:16 -0800 Message-Id: <20220117175019.13993-9-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220117175019.13993-1-stephen@networkplumber.org> References: <20220117175019.13993-1-stephen@networkplumber.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com When calling json_print with json only use a NULL instead of empty string. Signed-off-by: Stephen Hemminger --- tipc/link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tipc/link.c b/tipc/link.c index 9994ada2a367..53f49c8937db 100644 --- a/tipc/link.c +++ b/tipc/link.c @@ -332,7 +332,7 @@ static int _show_link_stat(const char *name, struct nlattr *attrs[], open_json_object(NULL); print_string(PRINT_ANY, "link", "Link <%s>\n", name); - print_string(PRINT_JSON, "state", "", NULL); + print_string(PRINT_JSON, "state", NULL, NULL); open_json_array(PRINT_JSON, NULL); if (attrs[TIPC_NLA_LINK_ACTIVE]) print_string(PRINT_ANY, NULL, " %s", "ACTIVE"); From patchwork Mon Jan 17 17:50:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12715638 X-Patchwork-Delegate: dsahern@gmail.com 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 E5A36C433FE for ; Mon, 17 Jan 2022 17:50:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241801AbiAQRug (ORCPT ); Mon, 17 Jan 2022 12:50:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241755AbiAQRub (ORCPT ); Mon, 17 Jan 2022 12:50:31 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27174C06161C for ; Mon, 17 Jan 2022 09:50:31 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id t32so11529653pgm.7 for ; Mon, 17 Jan 2022 09:50:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s84gFD6K8nRbdQ0hYrguj6cIm1G19Cm9TiBvajI/L5k=; b=vmNaGihsPygJDRrlTf5JqQ3BYMQfcGgdU9J27WmCEkmFi1kQ9JyNZY87qz8qZG5SJt 7mqXxLTNSdDyw4OHx5IW968rbKJPEI1oAPdiHYQGV7YU3jC3GUO88OT8LhxjHcfw7aLk EtQQ9IvJUu+hE80FCBGtJB2+JyEek+M6ngybJ2yjljvA9Cko8hCP1kRUcNiz8CVGDx8X 4ZwGcVlLqdSit5tA0aKRHkOGpULdQOBGkapc86nQ4BESPYOQag79Kzh+sXFgaKg6RDty zF1VuEAqBPGoQP+E8Bt4uw/PrCi4h8BfYe6eXWxv8ThC4ZSw0V3KXshPQjYMC3UwqRpH ic/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s84gFD6K8nRbdQ0hYrguj6cIm1G19Cm9TiBvajI/L5k=; b=qi7e+0YjWbYdP3ooYLfQt1HC3VgGOR9nd28nWudO/T6hUY1ylJf4Gwu2IMmfDe/ZtF tiFHXeeAMxoFFNNqtFNzLCHrhxFGru64VuxmqRbipfcEXjNi3BOyTnDDPIYn5qQb5bPF LuheWBrs9YAUUMXV78/dYOODZOqRLy8g7qsjSmpFQycvgDOcWcf20rFASc5xTJ+Yzpju R4oGwChf9vSNTA0NjjdqnX7n6IaDK17yL34zgrKvqkIW5j9O0GZIX2ue83et37AGPSaV w0lNInfNY4HBC0mGRSAH9qu+b5eo5hHlc/QEWXmTDMrt1QiQ4eKtBT4CTcbDmE3yUuhO 2iQA== X-Gm-Message-State: AOAM533HyZzJogbaJEpzrWiqBi3GLl2CoSa8JTaP7vsydXzeEkWzzmux 5SutC6mDjUsyCKdGCptEtFxEhYk2Vzs6IA== X-Google-Smtp-Source: ABdhPJxfNNlu2fnYPY2XOvRnEkrCNrep/OStYyLVRQwEPatWN3YA3y3WaoAHNCBoAevZE1YuxrPhXw== X-Received: by 2002:a63:7546:: with SMTP id f6mr20055977pgn.480.1642441830362; Mon, 17 Jan 2022 09:50:30 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q19sm15819117pfk.131.2022.01.17.09.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 09:50:29 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v3 iproute2-next 09/11] tunnel: fix clang warning Date: Mon, 17 Jan 2022 09:50:17 -0800 Message-Id: <20220117175019.13993-10-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220117175019.13993-1-stephen@networkplumber.org> References: <20220117175019.13993-1-stephen@networkplumber.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com To fix clang warning about passing non-format string split the print into two calls. Signed-off-by: Stephen Hemminger --- ip/tunnel.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ip/tunnel.c b/ip/tunnel.c index 88585cf3177b..f2632f43babf 100644 --- a/ip/tunnel.c +++ b/ip/tunnel.c @@ -298,14 +298,7 @@ void tnl_print_endpoint(const char *name, const struct rtattr *rta, int family) value = "unknown"; } - if (is_json_context()) { - print_string(PRINT_JSON, name, NULL, value); - } else { - SPRINT_BUF(b1); - - snprintf(b1, sizeof(b1), "%s %%s ", name); - print_string(PRINT_FP, NULL, b1, value); - } + print_string_name_value(name, value); } void tnl_print_gre_flags(__u8 proto, From patchwork Mon Jan 17 17:50:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12715639 X-Patchwork-Delegate: dsahern@gmail.com 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 1C4A9C433F5 for ; Mon, 17 Jan 2022 17:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241904AbiAQRuh (ORCPT ); Mon, 17 Jan 2022 12:50:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241566AbiAQRuc (ORCPT ); Mon, 17 Jan 2022 12:50:32 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 599D6C06173E for ; Mon, 17 Jan 2022 09:50:32 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id q75so3821614pgq.5 for ; Mon, 17 Jan 2022 09:50:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+3obGd755fkb4WLBRvKFVMCj+KdKngjztSAqkM6Xwmk=; b=YifXfObLp8mELHTj52CRs6o3kcWukAQ65Z5U6JH2G4pIffuoojBHhAAxAKhgOirqE5 o881PVgenWNKxJvzkB/6UhPkj9ISEC8chx9XHrz4AMLt8MCo1b03UjJBAisg8OwONYHy UWQcGH2QoPjnproplAm99O9svxSUGP+COp244R2WvS0QIDyT8h6OqE0LPbiY/0UqVfKT VSA6/LHltyBlmTkcCgjgazwH/vc2qdrvqGvNyB7nJOgfGL0aOaoH0lKMHHVQi8nZH86D EqFmBCXm/RrlpNGI9RzqBjyyDfVUwAzfMkHAOH6ZgADRHqywszrjj2wCWx04dAJaRL/x 5RLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+3obGd755fkb4WLBRvKFVMCj+KdKngjztSAqkM6Xwmk=; b=JQsVy9BsfL47hCkoP35Ghv/IiVYLwBZVUfQ5E7FAahEW2F1tC2A62pYRhrL+/hyU5W u9Cr67RjKM+1ZGgwh7czxLvarmDh1/u2MzSfxfZQ9Ca/xICSYDM+W9ygjhJGFQwwpUA3 Bg66TUcdjb/+NB4YIHWvAoFz0BISjXU8Krpcr/BAgLabvtiBOznvNWuzy7+L54g3YqbC nLZth2cdclZr8MQDElvTPJvG531UVMG8P2Lv/NTH0tj9i50CF1GlYQB7msfG1goVgwGM JMphDkdZ9eYXpwn4ELGOTmFR81Iu85iUsdURvGhwZ/8fEmkFwiFZjYuLgTdWWsG9X69n XChg== X-Gm-Message-State: AOAM530z0/nq8iOrVbHCjQpHbpzyoesBxPL8evyLVRcZFuy7r1xx7HKc qI8qPztsEl/UXNXhyHhJ+sYVONUh8TROmQ== X-Google-Smtp-Source: ABdhPJwqf3+qmdJJvOwI43UOIf/C9ZTjCNb46EPgx3o1mI0iNqRodK9sGp7L7zyCeaIaWzibOtAFzA== X-Received: by 2002:aa7:8394:0:b0:4be:ab79:fcfa with SMTP id u20-20020aa78394000000b004beab79fcfamr22157065pfm.3.1642441831551; Mon, 17 Jan 2022 09:50:31 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q19sm15819117pfk.131.2022.01.17.09.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 09:50:30 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v3 iproute2-next 10/11] libbpf: fix clang warning about format non-literal Date: Mon, 17 Jan 2022 09:50:18 -0800 Message-Id: <20220117175019.13993-11-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220117175019.13993-1-stephen@networkplumber.org> References: <20220117175019.13993-1-stephen@networkplumber.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com Add format attribute to the format string in print routines. Signed-off-by: Stephen Hemminger --- lib/bpf_libbpf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/bpf_libbpf.c b/lib/bpf_libbpf.c index 50ef16bd4612..921716aec8c6 100644 --- a/lib/bpf_libbpf.c +++ b/lib/bpf_libbpf.c @@ -23,12 +23,14 @@ #include "bpf_util.h" -static int verbose_print(enum libbpf_print_level level, const char *format, va_list args) +static int __attribute__((format(printf, 2, 0))) +verbose_print(enum libbpf_print_level level, const char *format, va_list args) { return vfprintf(stderr, format, args); } -static int silent_print(enum libbpf_print_level level, const char *format, va_list args) +static int __attribute__((format(printf, 2, 0))) +silent_print(enum libbpf_print_level level, const char *format, va_list args) { if (level > LIBBPF_WARN) return 0; From patchwork Mon Jan 17 17:50:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12715640 X-Patchwork-Delegate: dsahern@gmail.com 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 A2B96C433EF for ; Mon, 17 Jan 2022 17:50:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242051AbiAQRuk (ORCPT ); Mon, 17 Jan 2022 12:50:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241939AbiAQRud (ORCPT ); Mon, 17 Jan 2022 12:50:33 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C374C061401 for ; Mon, 17 Jan 2022 09:50:33 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id c3so22034508pls.5 for ; Mon, 17 Jan 2022 09:50:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ib33Nc1WOE8/cBTRuaybrv6PK430iHqYq4REXeC17gw=; b=v339RgVIQD4rLRHV7GXiBMLty9ZfRJn/gQCS4fxFMX2PZg7AvHrqmFI2K/jpqmQKGg q4CwgOv1u4iStsAIdsL9F8UFjd9CC0uwWfoTgAM6wuuZE0Dsd1sDXBkgHdRopJEeliev 2ElKL1LbVTXSTn7AyE2+IDcngE+n8LXENNjQuE9ycVyyXBYI0UmhDZp25WmRs/wLyYGb NR/6khXolqPBSUIhKjHglqKmH1HC6JdCkLzDGUr9WAriNzN73Kicm2RNtiHRjYV4eckC cQuBR0j4+ax6h0Tnkvj4SjD+mxPuAYvxMuTX4c+Zvf2e1+CIoCUo0EAMsI67Z7VP+0ax Fe2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ib33Nc1WOE8/cBTRuaybrv6PK430iHqYq4REXeC17gw=; b=6FUJN6fW4URIVMtWWK0//P24rW40RK60vtxXufCOXKqUfBWFpXtiMXqYjwITF431r4 3uE5bJKH3AitLgxyfnnVUZ9/N/O3NAMBWaAm59M8lmTHOyFqeLb0dy0NDDBFLJc2G6AH VNe6dYAJYFa7ZTacQxxTrsnbH2oxjnlC86bQd0AF7eqNQMwe9SqT6aGPbR8S8eI2mXl1 dKmjo4QjnvA25slVhTd9KUfEjEf0qj+F9bKNQ0yt9KDcM25Mv9u7lNzOveXfpl0wcGQG FfoheKKUgWSojCk52l4qeywiH6mwl6C9Argc3Qf62EbvvwuQP+RcVMSb7OK+1UxjyA4q nTEw== X-Gm-Message-State: AOAM530kOeFNwPTCfenMC1WgJrcyKqojVfYnliz5NqWDpEDSq3x3PH7F tA5t6DTwehWXszXz1EANA+x9QC15m3pmog== X-Google-Smtp-Source: ABdhPJzt8r+g+2AkC1WyChsIIbKACn4YNnlgNZeRnhl6UFOPi3TBczkAaA4DzcHQVi8Xyzh9OJwBrw== X-Received: by 2002:a17:90a:d596:: with SMTP id v22mr7604696pju.87.1642441832463; Mon, 17 Jan 2022 09:50:32 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q19sm15819117pfk.131.2022.01.17.09.50.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 09:50:31 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v3 iproute2-next 11/11] json_print: suppress clang format warning Date: Mon, 17 Jan 2022 09:50:19 -0800 Message-Id: <20220117175019.13993-12-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220117175019.13993-1-stephen@networkplumber.org> References: <20220117175019.13993-1-stephen@networkplumber.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com Clang complains about using non-format string in print_color_tv. The ideal fix would be to put format attribute on all the print_XXX functions in json_print.h. But that leads to further complications because the existing code may pass a NULL as format if the format is unused since the print is being done only for JSON output. The compromise is to just disable the warning for the one place it shows up. Signed-off-by: Stephen Hemminger --- lib/json_print.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/json_print.c b/lib/json_print.c index e3a88375fe7c..741acdcff990 100644 --- a/lib/json_print.c +++ b/lib/json_print.c @@ -299,6 +299,13 @@ int print_color_null(enum output_type type, return ret; } +/* + * This function does take printf style argument but applying + * format attribute to causes more warnings since the print_XXX + * functions are used with NULL for format if unused. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" int print_color_tv(enum output_type type, enum color_attr color, const char *key, @@ -311,6 +318,7 @@ int print_color_tv(enum output_type type, return print_color_float(type, color, key, fmt, time); } +#pragma GCC diagnostic pop /* Print line separator (if not in JSON mode) */ void print_nl(void)