From patchwork Thu Jan 20 21:11:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12719066 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 D045CC433EF for ; Thu, 20 Jan 2022 21:11:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377767AbiATVL7 (ORCPT ); Thu, 20 Jan 2022 16:11:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233724AbiATVL6 (ORCPT ); Thu, 20 Jan 2022 16:11:58 -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 61CACC061574 for ; Thu, 20 Jan 2022 13:11:58 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id c3so6286258pls.5 for ; Thu, 20 Jan 2022 13:11:58 -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=5txWYmihYWFt7nTWIt9AR8fhw9ZFpd0V41a7Kbl0rY0X01NzLNV7v0IOnFNAcpUCE4 SrTI0pkubN9TFvu8e9jfibESaNeXqXXk/SkLYjhrpi52DAtSsfEjIFVNtbH9zKupoMJ/ 9HBeHbEAqjnIUl6h6S0uW6LMh+sL22AyFk8IZomnkUias0xhYkmhanDRQCGywJGU4JIW NRS9dAzjcNLDplNK6UnG6pzzoRKYwToL9j6cftt3bjPLxhFGvT1MR2jodIEPBeo8ZuGK P/QGNdPnt0MtCH+KOUYq+uJlrnEr6BCvVtDBdbOr1DsXuDJebCeMouJ5m3e+io6nNLVN Retg== 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=28+p7mmJoh8P+ND6oxjHmDNjXgjtzrFqLQlIwsq1uOjewgIWnKOh4hUULJFxLWd1z+ wGwLuJ91w4GWaZAZXSd+PVqJSlZFf6RDCj5NThdTVH5DT0WqoCb31beu/7eBlvsytCtK SqkYZGWq27h/3cNHGMeGFeCrE29q+OISpGy2tM5yQoV/uz6CpLswako7NVMJLDKP0y3T R7c3AfbyoCxy9azu0/VJNCnL4HwO0l3N3XcCRB8j1jgkQ/tJzhMwhesqLOkJ492nyegd DqdyULXW1RerbdwVuU+76gJjOz3doDiRXZyGKkk7AqpqRUsXD0lB7nzCSO8FUShBxgYp TYLg== X-Gm-Message-State: AOAM530RRnGLPO3K8hmZTftlsMb/kbJW7FpU7R6PI+/172nP0NuszZ99 pkkbBvpO3lQOusnY+MNqzYgY8kzuPp+uHA== X-Google-Smtp-Source: ABdhPJyiYwH6HdAFh+1V+QcoAlyb0vKPL9cTMSg5ak5/PAWMKKPW/5r61SS5ZyL4z8Ny93itd3N2bw== X-Received: by 2002:a17:90a:16c9:: with SMTP id y9mr11245965pje.220.1642713117596; Thu, 20 Jan 2022 13:11:57 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id rj9sm3357187pjb.49.2022.01.20.13.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 13:11:57 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v4 iproute2-next 01/11] tc: add format attribute to tc_print_rate Date: Thu, 20 Jan 2022 13:11:43 -0800 Message-Id: <20220120211153.189476-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220120211153.189476-1-stephen@networkplumber.org> References: <20220120211153.189476-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 Thu Jan 20 21:11:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12719067 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 65C6AC433FE for ; Thu, 20 Jan 2022 21:12:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377769AbiATVMA (ORCPT ); Thu, 20 Jan 2022 16:12:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233724AbiATVL7 (ORCPT ); Thu, 20 Jan 2022 16:11:59 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56BFEC061574 for ; Thu, 20 Jan 2022 13:11:59 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id f13so6332826plg.0 for ; Thu, 20 Jan 2022 13:11:59 -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=vcowV/vGulYppKQ8y6QYNc/bHaMrTFffWbRhGkK0VE+yudP+KZqnL2aopL3Tz7gu1J fr1BNPWtENSNUIpmEbDiU3zfhnsTbXx1AabbxTRJGaiQ85ZNzceVwNTTWUoaxMo5pxyo 7Y+dQ5UtfyaWmN4ByKiRtr7Q6Svs8UYAKI60/x//m0ZlmPVg4umdrKT0vBdl+w9jIRFj 024utsuWGYRvnHaxmaUYI5rQGEEHDLwIcu0XMYJfsw67j3HUoWXdCenhOvhPCeaQqlkM s/30ycQ/zVMq6KJxnA8lGid7TjJfALoaE7wuAxFSI6tl5HQdEhsEok4G+WnOaIeq6W11 95Og== 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=cpdrXbE0Jh8FctC7KytjKa9vv2/9sTS9uZpL+GmrCySjcBE+5R43QrRn0AUwqXfPKs GWv7ZMoSN90DUEnlQG/3K6xvV9eB5ViBQy7eoCaJdBEQdRYv4N9bVilBVtUYr0yUFQqh p9CNjPCtjcoE1+q534pyB82Qgj4npJ/lIjDPBJ9wi9CqgjDZ0PY4AVihDR+CoKsigQfz DAYLNTHXmkx51xZ3D48nE099ij97+gteVnZdnkh+3JsXvTqgQOOAgxs8AG5rOBxXbfyb YOvo4FYRT444wEEor45dTAGiKd9BO8nJh+/LPIwEyMAcxj/XFy9wKDqzKOc7UPTlXIVO IMAQ== X-Gm-Message-State: AOAM533GIoS7WkpShoIDcAFwS4PF6lSbC8H6xVj7MC+cWTSzj9vAGs09 ocFya0Ws4JwlUMWg7avTEHzhGeJ5vTMLgQ== X-Google-Smtp-Source: ABdhPJyJ55gOzAs5TzjW++ps+TG93QRInyR6hJdlZG4PM7uyO4EFCE9gnbW3RcwcIxi0IXBWYqTDyQ== X-Received: by 2002:a17:902:7fc8:b0:14a:e403:2f18 with SMTP id t8-20020a1709027fc800b0014ae4032f18mr831639plb.45.1642713118512; Thu, 20 Jan 2022 13:11:58 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id rj9sm3357187pjb.49.2022.01.20.13.11.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 13:11:57 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v4 iproute2-next 02/11] utils: add format attribute Date: Thu, 20 Jan 2022 13:11:44 -0800 Message-Id: <20220120211153.189476-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220120211153.189476-1-stephen@networkplumber.org> References: <20220120211153.189476-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 Thu Jan 20 21:11:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12719068 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 D91C8C433EF for ; Thu, 20 Jan 2022 21:12:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377770AbiATVMB (ORCPT ); Thu, 20 Jan 2022 16:12:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233724AbiATVMA (ORCPT ); Thu, 20 Jan 2022 16:12:00 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F2E2C061574 for ; Thu, 20 Jan 2022 13:12:00 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id n11so6286197plf.4 for ; Thu, 20 Jan 2022 13:12:00 -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=rIaoHDQdNByK61V7eXYipHjIW9GWUulX+GYwEHkvZRsGLC+mdWq9s+hpfL+dbkQSGL eWPj+bXTa/4zK+FWMVoRbaMvoFqdPYFbbaX7ZnIX8ZftZlARKQGbpmGYb3NBvCnfQ+Rz vShdFngArogosP1ZUavP6/jmuG2IKFUqkNaxBo6tsySX9fIyhtDk9BAwD1o+MftVc7+b z7kfA8DL8AVQXl4HAYTOzoulRKYlN/6GADuD4yFLx/YOVCxeTKRXSGminAwvSNe8byh7 /+VoJpwQDyN/Q2rQAt5ipUVWXNx/22Hpc5TufD8kPrN+tGUeB55BqBWzf3cDBLllJqKg pAdg== 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=1cTqGgqfGbjXuwFiLIP1A2ouRn/1kYskAaBdZT8S6dT3Upw+2Nf/skJYkUHvM24pQ8 rXD19GjSJ2X35tEab5tYzPE/8tH7Nb9Uo9coZtdbZCO3nB36ZkqDmLrsNaC0fuDArg4j erkpIdgnT/pfeRYeekFnB1/BLKmjDcKFm9OmgyoFX6vtHoQfV4luzfyzIG3c1tIp4FMP XA6ixdSMTPQufjKRs8nZVkrBtem4199MqrUsK9QuMkb6mcN+6/Xx8tE1OQKoQFdeaoAo OWutV58oNnx9hrnMhqs9jDrHlwIgaZo4vvL7iG+oEkRJUbKvSKW2SV+X/sUG2eByzblQ K/Hg== X-Gm-Message-State: AOAM531YMOa3b2bKbdG/gNHU5D7kS1+Cuw4dvcRIcumrKy/qGh7t4XWb YjZbJIaG0cKRdIixryumDEOuSYLGu3RraA== X-Google-Smtp-Source: ABdhPJwIxAMz7uNO5ocauIyfccgOgQdIwuUiX5HL8ToAl3d5bR+9377i7jnimwWsDKNtX0n0Ns1svg== X-Received: by 2002:a17:902:aa88:b0:14a:bd99:24ad with SMTP id d8-20020a170902aa8800b0014abd9924admr880116plr.162.1642713119490; Thu, 20 Jan 2022 13:11:59 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id rj9sm3357187pjb.49.2022.01.20.13.11.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 13:11:58 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v4 iproute2-next 03/11] netem: fix clang warnings Date: Thu, 20 Jan 2022 13:11:45 -0800 Message-Id: <20220120211153.189476-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220120211153.189476-1-stephen@networkplumber.org> References: <20220120211153.189476-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 Thu Jan 20 21:11:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12719069 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 8985BC433FE for ; Thu, 20 Jan 2022 21:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377775AbiATVMC (ORCPT ); Thu, 20 Jan 2022 16:12:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377771AbiATVMB (ORCPT ); Thu, 20 Jan 2022 16:12:01 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B60AC061574 for ; Thu, 20 Jan 2022 13:12:01 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id h20-20020a17090adb9400b001b518bf99ffso3895745pjv.1 for ; Thu, 20 Jan 2022 13:12:01 -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=pa06sAuIA3ZlMeH510153FlurSUQW0i8GFOrKtZEJKp/h9f3DQKz7x6cqKXEgOcOdp Uk1HDxaYu2BR3FHttIOJimS648lVNBc9jYrvRDjPGRfO1+X5XrFsTteiqRAyczdmALVU B4bUy5e6jSz3HpNd8qVnpZH2k+t8npuktK/kAIrtboUOJwqll5+xBBToehHxNnmguImL fSwMFj29cHcIQoX3htpYv8WndgdtyxVu/hPXks+ap17jEscn3EDn+ToXMsoyogZTPBwP JqOicj1hTTqh9eQjWJficxQXOj6RPoGNMv9EK0yGACTLT0CQKS9R6sp2q8cEw4necsKz v8Qw== 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=jiFa7RrL71Hgkuzp8T0fY74iRwZkBh8kO/Pq71WtZFliZCrPwDTkDgwjpzLsEaPDzi blduySYaSg6ptHSc+HRkAktrLH3zHTamwOGYFMpD8Xgud96Ji7bTDADxvOF/yZnrRglF QQFp04cRZZNG0diitcSPO6hj1hX7TUr3YhWtfFHPMlIeZPZvYLypKni92cGh3xc5oVIN k9o326aJ8rWO4felQIjbcYiG8jwTE+F24On5nlKGa54ns2Es2EiMz6UFIiHne0+oOiTj FB3f2i7+20QmuVPDXZl2agbgz8j69ifzQrP/5tbYV9geYhr/vcGDas8nvluoAvU/sXAW z0QQ== X-Gm-Message-State: AOAM532AY03zJ5TseQoXID83agCC7AvPPebK8fy8c5YM1+fYcutzmQ2w hXWkcHGCeAudYLeYdQrT/YDftr4GZm3UCw== X-Google-Smtp-Source: ABdhPJxv+MVvcxT9EX2Dp7Bh7pkM5096K1/4eR9yHP458UjGeSk7OLsPX8+AMDstY2aWxq2SRtsxuA== X-Received: by 2002:a17:90b:4b41:: with SMTP id mi1mr13130898pjb.1.1642713120622; Thu, 20 Jan 2022 13:12:00 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id rj9sm3357187pjb.49.2022.01.20.13.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 13:11:59 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v4 iproute2-next 04/11] flower: fix clang warnings Date: Thu, 20 Jan 2022 13:11:46 -0800 Message-Id: <20220120211153.189476-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220120211153.189476-1-stephen@networkplumber.org> References: <20220120211153.189476-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 Thu Jan 20 21:11:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12719070 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 3F439C433F5 for ; Thu, 20 Jan 2022 21:12:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377773AbiATVME (ORCPT ); Thu, 20 Jan 2022 16:12:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377774AbiATVMC (ORCPT ); Thu, 20 Jan 2022 16:12:02 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 842A4C061574 for ; Thu, 20 Jan 2022 13:12:02 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id c5so6337444pgk.12 for ; Thu, 20 Jan 2022 13:12:02 -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=1nEsFJLJg2vcd3p5d51yw97QENDl2n12W9wExXuCur0=; b=pMk2S0XhMkwE/+d8Br9dd80IYJE1U45epYeLpSqPEkofxtJ2yaRmUzyHWNDinyf114 xFUVnQZC77ZNL8ZDnWlkl4aZD+/7ftiICDcq+ALlPgTXXaomo1RifGTOlbdg0kcmiYbW Uvr2/xvLa43PMFiq4Zq9ik3CNl6cnV1iTYcdZ29fyZ7uNPSOake5plTkWX6tMO4OV0DL XWVgUyVhwzw3tK5WQxH9ig/WZaTI2e328TVLwpieu7j8CiJU/qiXtssSbAyEYA3WEEXo 0/IDELgAWS2pINPhzIG9JOniMXrLEXg5X1ZofsfKPKwbI2/4+FTLFbCx2PnLBR3Lpke/ KeWQ== 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=1nEsFJLJg2vcd3p5d51yw97QENDl2n12W9wExXuCur0=; b=xaooXgG7fVpaHpGd+jbmp1Qsv0gfERyTtH+YdyOYzRv/TyjQ9JV/E1+4Nb0uuMMUvl qye3WgdIIfqIeUI/PokXmNmDreVmPkfP3JLtxahNjAQCakJ9bCiPztC/7at1eMJ9p9a9 whPDlY8kRzmTGG2r6EjMdSzzhG6lEEP6AweTce6DevGMQDZeEM55ShvLxKDktvsZdCl+ GZYKfdreeHwtSs2icHu81qe9Cl4r3/4/XbuVXOMEG+UlQQgYC/ZXtKToWJiQQOsLSaNx 27LgXtibiUGp5U/Y4JUcurgpMr+MjiGKQ6XKhSZvcofLExsFjLntMw6kwJWY3KI2u+kc k+6w== X-Gm-Message-State: AOAM532s9otx2dQc9RemBkk+S8v847TWtOp/rSYxCm03biOp0gINDf9v WMki5uJGESPLGc/ITVOoGsQw7vsLcm6krA== X-Google-Smtp-Source: ABdhPJwszL67QEiDzF8RJ/7n/cmP5ieLyAwxFzVeExErJumYR112tEHQgeKsAYZuLIckA9IgkQeBrg== X-Received: by 2002:a65:6859:: with SMTP id q25mr506618pgt.452.1642713121702; Thu, 20 Jan 2022 13:12:01 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id rj9sm3357187pjb.49.2022.01.20.13.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 13:12:01 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , elibr@mellanox.com Subject: [PATCH v4 iproute2-next 05/11] tc_util: fix clang warning in print_masked_type Date: Thu, 20 Jan 2022 13:11:47 -0800 Message-Id: <20220120211153.189476-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220120211153.189476-1-stephen@networkplumber.org> References: <20220120211153.189476-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 | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/tc/tc_util.c b/tc/tc_util.c index 6d5eb754831a..78cb9901f7b9 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,18 @@ 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); + if (newline) + print_string(PRINT_FP, NULL, "%s ", _SL_); + else + print_string(PRINT_FP, NULL, " ", _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 Thu Jan 20 21:11:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12719072 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 A8A30C4332F for ; Thu, 20 Jan 2022 21:12:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377778AbiATVME (ORCPT ); Thu, 20 Jan 2022 16:12:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377776AbiATVMD (ORCPT ); Thu, 20 Jan 2022 16:12:03 -0500 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 656DAC06161C for ; Thu, 20 Jan 2022 13:12:03 -0800 (PST) Received: by mail-pg1-x52d.google.com with SMTP id 187so6158882pga.10 for ; Thu, 20 Jan 2022 13:12:03 -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=LYxdQNpL2ygSOeu29bkG1tv44wtxVNXfbose65mHFd1TUYM2w7cSihgBHE0LuBGppe ha5ZxmZtpES2G6EoFsCHCJKI8H7/ARNpINWRJhca/8j+b3QHY3QcIpirvXxl1e1zgGR/ zU+JNTA11lO6GO0Pi8FVJUEjKyqmXYtBhMVdVjRgS5dkKvD6F7nvepgvJgWASAMdDpxv 6rdGddMlHek+YdMZca9vaof5sfHU0oI/cJrYMaWQaGsIVh+ZjJo3rQc1VZxHAJh0TkSV z35bV6/rCS3dqqGerOASZnP51TiggZZkYawWTSWUfN5EtFH7cNt8J5CKdC6KfKLPG9YT n4BQ== 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=q2WWXR1Q7Qqj8cBZ3QypuLyoxc236csve78ag3Epkqgv8JL1kWlb84dRX4ICiTN2xb RBbjkhA0xYZcSbnv+Q5WjbPAltTSc73w6A9Z2QXv8SP6TH9dxgdQYPI0KUY+ftgiRTrQ 8pnsZCeUSFgOIJGdw0FAyeMMwxz8HLHh+mBZoRSL0i9qVR8wuu1N9UGscD+nui8qERGq QCEtunjEtm21pz7gOkh3eunNCqoUCSMYWNJv6Y610KgPzciIaGov8kaQJQY3jcuTyq8j ywMfSxGzoAcopwbCc98jg8If6QGUeEWd1l7pBFd9wHVx6wSqYR2ySLx1p6HKvvP5d6bQ ++1Q== X-Gm-Message-State: AOAM5333kY7v+M8qnxmfcYd5oxrmJgjx2Ww+LJl7i0wPJnZN4LB/ZFKd AsRP52yUMkZMJBo5mrCvl4ChWv8mpXAsQg== X-Google-Smtp-Source: ABdhPJyjTvE6UIcB9mk/oghTfN27ZpM1rSz33re9SoNVHZjOYFORho4DUfmlYJNjrrI+Eco4D6rEcA== X-Received: by 2002:a63:710e:: with SMTP id m14mr476056pgc.277.1642713122657; Thu, 20 Jan 2022 13:12:02 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id rj9sm3357187pjb.49.2022.01.20.13.12.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 13:12:02 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v4 iproute2-next 06/11] ipl2tp: fix clang warning Date: Thu, 20 Jan 2022 13:11:48 -0800 Message-Id: <20220120211153.189476-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220120211153.189476-1-stephen@networkplumber.org> References: <20220120211153.189476-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 Thu Jan 20 21:11:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12719071 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 4DC2DC433EF for ; Thu, 20 Jan 2022 21:12:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377779AbiATVMF (ORCPT ); Thu, 20 Jan 2022 16:12:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377777AbiATVME (ORCPT ); Thu, 20 Jan 2022 16:12:04 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79972C061574 for ; Thu, 20 Jan 2022 13:12:04 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id t18so6261577plg.9 for ; Thu, 20 Jan 2022 13:12:04 -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=w1w6v8pEOL/+Ge1FFFavo5OL7raZfrz3kUhWo7RGBs2qv+U4sZaigCZzr1LJxcIWl6 LszkeFAmil9FYpy7OtChAXWGunjhW47Y1+BStxHupExnNdXiYxl1jx3TgqSS0CA86pgb ZRcLsNXoDmhLA2Zf8xeKlXwqbBHIlQdeglHl8UB3ywzNZaXW7gbs5jbrsmuAJrUjb5Zx 41QtKyfeXnTDZ9PpsaPW0nbp8/ACwHEkZw26HbPA/V3oAH/WS72sJlXS2fm9tuLbGoU9 ys3sZxNmrgcIpnKGTcAvKLGO+FYx3d3GLRMrZ4CTq07b/3XbUM+vY/4xon35rW528xAG plvw== 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=iAKa09CKbjYYw6F8TFaFptza1NONfkzCdGaL79WPM0hp+H6/n8Wr0MZJSU59fg7P4L nGqpj3m41LhDGhBmhzAMgz2+Gs3vbNPGxPZDmty8s4hZPvIAnn/iNX+h6VKplLZmJGNM xdZe4LA5VNFihXSr901uZKtl7sla/fztlxiHYaKZYa9yfw3DjswTOq8i8WiT5xkIUhuB JSPWTvxfBuRtj2agNpb/J5+uG9qLTRgpUxETYsAuRX+YwdO7lqeW2YfpYSiZeu3PcDzv tEPkyAPNGhL2VVEG2UIfB0Fq3TUf9zlCX854Cg9lzm4sGSLQf41ZvXjJ0OUHzW0H/aXX qqTw== X-Gm-Message-State: AOAM530zaWt6d9Uw7NOu2PbbsHRgbQ0MJXgLTOCDuWjO7NUhqUfmsbcy cl/QdoTRi6Zt8HHqcOMiUmu0g/dD4jptCw== X-Google-Smtp-Source: ABdhPJw9dHfdYJF/MQFO9ryObJNXV+ULwPiDddLVYsIjhDlN9MmoTcyFSGNoyKjwjivfrnhd2kLsIQ== X-Received: by 2002:a17:90b:1a8a:: with SMTP id ng10mr975280pjb.175.1642713123741; Thu, 20 Jan 2022 13:12:03 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id rj9sm3357187pjb.49.2022.01.20.13.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 13:12:03 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v4 iproute2-next 07/11] can: fix clang warning Date: Thu, 20 Jan 2022 13:11:49 -0800 Message-Id: <20220120211153.189476-8-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220120211153.189476-1-stephen@networkplumber.org> References: <20220120211153.189476-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 Thu Jan 20 21:11:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12719073 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 7CBCEC433F5 for ; Thu, 20 Jan 2022 21:12:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377783AbiATVMJ (ORCPT ); Thu, 20 Jan 2022 16:12:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377777AbiATVMG (ORCPT ); Thu, 20 Jan 2022 16:12:06 -0500 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A8BCC061574 for ; Thu, 20 Jan 2022 13:12:05 -0800 (PST) Received: by mail-pg1-x536.google.com with SMTP id e9so6375585pgb.3 for ; Thu, 20 Jan 2022 13:12:05 -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=EJA0z/Yx1G2LbG0RG6Q/M1LTJksD2bgyhAPQS0FwKD0RyfG+faq+r9qM6ODPJitX+R GO6DSwC6s3T59XpkkIPZdTSXfIx5u3jZwhPcs3+C7GxtxN90vnOmCmeWOXwL7acZz8P2 gRt3KAU8cFJQCDcH8UHTh03KDUlGoowe/njzVMEUbV0GQsv615cxSEacX2PVZNSkWae2 e/aHr6HSQrt1N07lSgHUooNW7L/IKzWqAbShh5LtTgQwpMiaU0ReljQ/ojbbeTjTV3AE o+pct9E6XDrzmoxCDPq8U0HGtwRJ3y5tdcY8XgNLc7yrtjUjVMjBQBwkcp6vb/2X0SVI HP8w== 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=hYdkV3KkBK3/KDiIV/GYrG8NVwd+005PsV48dl0a6WY0nDNloEiySa2HlqUjnKthp5 v3zM0Mr5pZwVraYTbYlGu8EVvhTYuB5u0dwk4IbsdPS8t68GTng2y8VZWrqkPU1FWmEd 1w87d1l4CaRdvVTr57pDTt8lY4ZACuDKKVB9jAisMh1suPs1gONI5N01i1qblM+9KTin 4hL4HCdbakdeOfp5HDm+j29fuudGfqgnG4v3etjgTUy8GJOdhccHYB04BVSUwrMS2Zst h7ykequ/xMfTKDsEGyYkttVDv6TShrRRjT9KF2yQGlBoV4l/KUyBwrj+frx2VVxtNJXs 8upQ== X-Gm-Message-State: AOAM531+RGTsV1yVMr96jpZ28v0Ki9YxFU3z6HPR+9l4c1EDhGVOLjWQ QwoHnYinwZfgWWahEgj7M0yn0iFksQap/w== X-Google-Smtp-Source: ABdhPJx6NUpKxTH/hUNJrDsky20WeXJa+G7C5lZPRf4XXr5zSkj68J1RvnyR90CVoG2Af409kTxFzw== X-Received: by 2002:aa7:8043:0:b0:4bc:1e18:466e with SMTP id y3-20020aa78043000000b004bc1e18466emr748291pfm.49.1642713124639; Thu, 20 Jan 2022 13:12:04 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id rj9sm3357187pjb.49.2022.01.20.13.12.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 13:12:04 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v4 iproute2-next 08/11] tipc: fix clang warning about empty format string Date: Thu, 20 Jan 2022 13:11:50 -0800 Message-Id: <20220120211153.189476-9-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220120211153.189476-1-stephen@networkplumber.org> References: <20220120211153.189476-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 Thu Jan 20 21:11:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12719074 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 D8BD4C433EF for ; Thu, 20 Jan 2022 21:12:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377790AbiATVML (ORCPT ); Thu, 20 Jan 2022 16:12:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377780AbiATVMG (ORCPT ); Thu, 20 Jan 2022 16:12:06 -0500 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E93CC06161C for ; Thu, 20 Jan 2022 13:12:06 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id h23so6332349pgk.11 for ; Thu, 20 Jan 2022 13:12:06 -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=CRDWgt7Qv9rNcLZWDEqFPw+QeZRgFqMNw2ACHaQ0rzwFQFqQNsy8J8b3wplYGamfZ8 12vN31S0TXmNzebjEe5lZCka/OmUFozcTeAWOvWJVBskGwSe+FJqZmeIwiFcuXKBFTSL tDwFPgoooZewYtLXw5jp/p9WWXYDHXs5Esbut/psrd9gl+aIFvGVMgJ7XcPkBhTODitd tsmUddZl5i6nPxnT3lNzgXvvULjHSr8G1e9vFI9A3yAkIhtCBkjjeF1EUirwcOy9hROt bm9chghgcYvclkuiQpZHK55rOFE4L1u+2UZNN8Z73eULE5zYv5LMZEWKvh0KUL11mkuH xHew== 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=2jGb5lLcqC+JALE+ALkPG2meZ8I9XeXjxK1+95cprMkK8aJx5QEe5EfIlSHp4X+sWp 2rDxjVbBMuKdXFBbONCn46+U/QAfhwKneYGCT0OrUKBn05u877ya8ll2dD9UUu5H/tSS Tk6aR/eBAMqyf23jR7ev4sLvLe7V9akgz9rOJgc02wnQ7INk3RH6T4ZYEFH1golSeGwH Ecfr1InWed+/ISzJn7iJO12kR0l6wyr0yQKhiP8rTOl68HM1+MX7w43NAG7SxxLW8Dln 28UFhZws3n3y9/QWCsPUQUqTU60hXXkFerJ2QQnDHj4Qo10VaXFPZeJ2Pp5MD+vF1ner V2Bw== X-Gm-Message-State: AOAM531rPK5NNNRwiiC5O1TdpnWKS8eMjI7HN8JnUe3KNtVWbQXzIwmT tgl9s3vhz78NNxV00ccqQzh8/SoGcvhkcQ== X-Google-Smtp-Source: ABdhPJzLrN4uFnf3DVg6t0NGBv76dY1VoDJ2TqXzWQjB7S0Cq8CGtRcIaVptGjjjNZxLyApop3mmew== X-Received: by 2002:a63:9f1a:: with SMTP id g26mr503460pge.524.1642713125614; Thu, 20 Jan 2022 13:12:05 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id rj9sm3357187pjb.49.2022.01.20.13.12.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 13:12:05 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v4 iproute2-next 09/11] tunnel: fix clang warning Date: Thu, 20 Jan 2022 13:11:51 -0800 Message-Id: <20220120211153.189476-10-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220120211153.189476-1-stephen@networkplumber.org> References: <20220120211153.189476-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 Thu Jan 20 21:11:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12719075 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 B443FC433F5 for ; Thu, 20 Jan 2022 21:12:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377791AbiATVMM (ORCPT ); Thu, 20 Jan 2022 16:12:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377784AbiATVMH (ORCPT ); Thu, 20 Jan 2022 16:12:07 -0500 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C82FC061746 for ; Thu, 20 Jan 2022 13:12:07 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id i65so6732253pfc.9 for ; Thu, 20 Jan 2022 13:12:07 -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=UmDHmzTf4buu0zHDjBqOqbiRurotKOAM19rOkybKy9KjlGV+0a4ctZa2nd0uhLzAG6 WG7WuxKImpfah9OM/zv+XH2AfeYUshojhOFl6X6JdIbIJ9+24729YwbzgXAivFR2Yr0c +sU6eDBA0aV69xFSD/rRD9Pk/+etNzO7bc+XHp98OzEpAnBZtddKAyk4rkiSQQWafx8E 5ZXLxR79AdvCmy19LlXCfZ1T34CD0kT3oMHPfzfrWNVrZ7JiFTTbFyNrBynTSe13fuG8 sApVuHNkdIWDqTPNtGvxp3Go6W5YXAVeocQEqJ00M7Gssmu+8B426UVUgjtc5Y1VPhAu zpRA== 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=3pluOvRins1hJVlMaWY8E8vShm7Y+XcPVRBDzlmiTr2klPlx05VcILye7uvpCaQvIo RawIhmW+SiirhYkZuP7lefph+7qaUCbQ0xxJ+4lM9NUjnJfvAo3YyaA/8iDZnsqQcHSR hiD0KUxOvzqX4JQk6f5sZ+y0oeNARmO/nSIMqaPW5+nGUv2Vu99WhS/61jN5cFf7f6y7 8KIhAXF8jmoSgB9bJzsupupmS67uEUymfO0C67VILV2scxlr71P2WBSAA6b8htV9xZ/q 7c1GFl3PjFyjBNqo9GkvV+aESAYkNwuLA1XzwloGmNqivisVp0FHKIma3ema0+bonGor d7KQ== X-Gm-Message-State: AOAM5318Pj7unJ1q3Pmcd8Y2ji+kPPFprYTS3XpdaN/rXBF6/EfHb5VL YJ5AyZ0cs+twr6rhQ7p/EgqD2hEmOc3m6A== X-Google-Smtp-Source: ABdhPJwz6BnW24bEFqa2HMDtuzWkt4j/XKsLtQOl6RI5JZuMk+qX2ouqSLQe8wBxvcuFgtQ3a5oqtA== X-Received: by 2002:a63:91c4:: with SMTP id l187mr228600pge.513.1642713126470; Thu, 20 Jan 2022 13:12:06 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id rj9sm3357187pjb.49.2022.01.20.13.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 13:12:06 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v4 iproute2-next 10/11] libbpf: fix clang warning about format non-literal Date: Thu, 20 Jan 2022 13:11:52 -0800 Message-Id: <20220120211153.189476-11-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220120211153.189476-1-stephen@networkplumber.org> References: <20220120211153.189476-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 Thu Jan 20 21:11:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12719076 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 7D4F6C4332F for ; Thu, 20 Jan 2022 21:12:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377785AbiATVMN (ORCPT ); Thu, 20 Jan 2022 16:12:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377787AbiATVMI (ORCPT ); Thu, 20 Jan 2022 16:12:08 -0500 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ACA2C061748 for ; Thu, 20 Jan 2022 13:12:08 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id 187so6159267pga.10 for ; Thu, 20 Jan 2022 13:12:08 -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=ph0cLbiB+j9mUQKsmxAJo0BP4IfbPgIjebLITiIgTFL2KtjtMF9ikw/uu/DYMYs3VB PvKJ9EP8js99sBzIadnpb8WR9Nncnd6stmgOWpO12Xda8tgKVtjzWbx0qyAEWwA3vnJz SkiEbfJ7P2Co9D9wi5nMwTRONYT1lhRh1FHY/d4XnWSFPezRmYywWJl2aocCbjLp0UDU 9wgqqYu39xLTFlByS2ux+7JwPE407cabcoQTb95/UrfVgU87ra7JWDaqKygLmcGTI0aF hGUzWyu6R5DzqBswxuuTI6Ws3E/f1Jd58L4C40s9ixCS7okaTJOITiecVMxqbKFTaDze JByw== 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=zedJs9Rh4QPtFSW7KqnxzeJekx/N/gXmKDfN9tpEp+IXoPw5XzWfP2WbHDIv052hzy 3m7GQMM88HVA4ALSbnQKGokNrmbcYHI60+ccuhWR/yTj/pBVYbyWR+Sf5tbBRnvn6p1u 9VXsuRSNI0wg21aJb3+AUZqQ0OgwMs5+vYH4FP3CeboOjuofaEklLc6wM4Rl7ZjPPi7c bAXtySRE6yQdpyJ/3jk7qbiAeF7PfaYPbrGprgiX3+hAE4hzkXJY3OwoP1g6n2BcCQ5L gklqq6a8PTHsGxw4KrmGR8TuukdsC3q7k+BcOj4Cv3enSacQBhMGAOpTeNMRc9fkC/E3 N8EA== X-Gm-Message-State: AOAM533J6W3Ru6pkewCEKMJ/LqZnc80SNK+QbeRAJIT+vSRvnae/1Mw3 SjoFF+4Ah78xWQVLl1uCQRQSgyboAjT75Q== X-Google-Smtp-Source: ABdhPJwWUZnr+Ui7AimZ1RZp6JXyknsg2HUoN1ZGCQ89xkpA1iHhywCpgDvLRiEO8FXEvpUIh7//wg== X-Received: by 2002:a62:2f86:0:b0:4bc:fe4d:4831 with SMTP id v128-20020a622f86000000b004bcfe4d4831mr520251pfv.23.1642713127444; Thu, 20 Jan 2022 13:12:07 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id rj9sm3357187pjb.49.2022.01.20.13.12.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 13:12:06 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v4 iproute2-next 11/11] json_print: suppress clang format warning Date: Thu, 20 Jan 2022 13:11:53 -0800 Message-Id: <20220120211153.189476-12-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220120211153.189476-1-stephen@networkplumber.org> References: <20220120211153.189476-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)