From patchwork Tue Jan 11 17:54:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12710223 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 7AC11C433FE for ; Tue, 11 Jan 2022 17:54:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344862AbiAKRyq (ORCPT ); Tue, 11 Jan 2022 12:54:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344769AbiAKRyn (ORCPT ); Tue, 11 Jan 2022 12:54:43 -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 791F8C06173F for ; Tue, 11 Jan 2022 09:54:43 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id i8-20020a17090a138800b001b3936fb375so6727171pja.1 for ; Tue, 11 Jan 2022 09:54:43 -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=Dcd0/g4UbnpmQf2lYWpQMozVkbYSJ8CoZkn58HCH4Ik=; b=PVptpwA9gU9pbg9aVcASMDv94FS06VmUj1TGnyqdV+Doc286rQSIHqhQzDEvCcuedS aBExTLUhh9wPKfyLpCGZbQayGW2yFlWcv3/FtCzCTk03+JUDjsKoBM/YJBS7rIg8RXgd mLImNKYTQd31Fln3xuQK9xHzO30pwtjTh+NAe5NvaeJ/zZauYlv/WhuwVdhlGlB6w2ZQ BPvDzRgUfCWsv3KW/0a+1QLL605rPCg/XIRNUmtwJQJLJTXg2B4n6ncy3K9DoyB620oM jLxtCzyYag+4nPt6Xuap6jOrJ9KJ4IJeCJJqEXgNUOXrQJ/JQlpK/laWX6dc27znemVj oxOg== 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=Dcd0/g4UbnpmQf2lYWpQMozVkbYSJ8CoZkn58HCH4Ik=; b=uA6MG1ABZpPbk1MdBjvUqob+yDRKBjguqQvtg2+XAtYcd+6IYn91ZZCmoSmAjMCmz+ 7WRc2gE5rmBFIZHb4F8Hldc+qvZSNn2JS8SZZI0uHrVfcKeMPLOp315U+ydt37VxD52R oNn1g8OxTj5YuwPjA+j0hkTconfEFb/e9iKYLuiYFmeWIoqL0dMWpLeQixQeJ/ZB8K5P NntzzShlUm9eYToDhj8rshrDvwsBnd8yoBYn86w5NJJTEgEAX4H75csy3RwTNUVwyMTA prJITTe4bRbbx8lhoHqaet03PzLL3GgKn1zbS6n0u4jWyQVbL6ifik0wLpgWU9aIKLMl 7Qsw== X-Gm-Message-State: AOAM531YEFayJWHju4xLl9b02aahbXHx34tbS4VgKeGskYnkjQHjjCwa FzaWlFjJ4qgw4ZPuYhFKeM3j6bfKDYyEVg== X-Google-Smtp-Source: ABdhPJxEJDBgo6Of5z8gJaW2wzVz4qhsGKDnEKtBU1ReH27Q2Utct3R99AOJoDmjQG3bmoM9tfeFFg== X-Received: by 2002:a17:90b:1d8c:: with SMTP id pf12mr4505311pjb.42.1641923682698; Tue, 11 Jan 2022 09:54:42 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f8sm23925pga.69.2022.01.11.09.54.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 09:54:42 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v2 iproute2-next 01/11] tc: add format attribute to tc_print_rate Date: Tue, 11 Jan 2022 09:54:28 -0800 Message-Id: <20220111175438.21901-2-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220111175438.21901-1-sthemmin@microsoft.com> References: <20220111175438.21901-1-sthemmin@microsoft.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Stephen Hemminger 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 Tue Jan 11 17:54:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12710224 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 BEB41C433F5 for ; Tue, 11 Jan 2022 17:54:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344886AbiAKRyr (ORCPT ); Tue, 11 Jan 2022 12:54:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344362AbiAKRyo (ORCPT ); Tue, 11 Jan 2022 12:54:44 -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 8A240C06173F for ; Tue, 11 Jan 2022 09:54:44 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id l16-20020a17090a409000b001b2e9628c9cso167995pjg.4 for ; Tue, 11 Jan 2022 09:54:44 -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=XNRt6/aITGiiV0hFDQpp/ZDiBu3MId5tidREj5NDK10=; b=FDjYGWd6T/hxoWbO2LPXcNt1tF/8tq7hKxt2bXqI1j0fALHzDcP402MmdJ9GjSH8u6 qBOAISS+7VFopdzcwQM7p9SK59sjrXHSzJ1xnzUykhDILer9E/csOl1SB1dVQyhBrHDl l2r+6MlaL0GFM9nRpL8Gf4P+Cw4qc6taRalEfTFabLN+438E15TKQxsTK5dxS3YjQdmJ ySk8cWO/u+wZ4lBTLBahBQnF0LnT/BqhiQIMvIIZhr0/uvsfzcwWjTyr2QKNKVgDgd1B lo8qVnXsDpRqFFqdBylMjNAce4fQ2PQwXiN3OleYumiSl5onagcKJ1cokjzXWsjrQcTJ uo9Q== 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=XNRt6/aITGiiV0hFDQpp/ZDiBu3MId5tidREj5NDK10=; b=AzZmNnntd/8p9HsGlivGMjNF7te3F8njm485wtKX9qJQtxuKNK8pWc+o4pO/UAP/eh BTXJ2sjuXsOS12LQToM3qBHpGGt1AqKR3wcb9A1PrrhPBZK8Qe9IbeIlOb/3Hnrp1lm6 +ZTebTqCC+f0nZZUVUTvdZznGP9PW1C30vVH60rjaGFRYkiLSkJzBPYrT7wRqsn7IEo4 uRO07M2lE51m8Ld/5m2UH+4/s3A71JwjcL18z9naNTdQiuxxBMPTUDX9IrXXMDA2jp2p 00JnXXRmoGWI8u3mJ88W+SP5fUGr9E9hSltLfWRDPW5kHn48ltPsxySlcPCE6iJh0+se yMRw== X-Gm-Message-State: AOAM530TRVJHbxY2rYucAfRPj5eKHW9VGOI4N72R0w5STq+2nR6g/BBJ RC0aFn1NeUPmmaYn8QC/QgWdNWnBBb4/yg== X-Google-Smtp-Source: ABdhPJySqez4DEth4QgRxxaUznnAF5Mj073VqsIBfn8RIElToo3dhj0WMDxESh30D1vJYNlNrvRaWg== X-Received: by 2002:a05:6a00:1818:b0:4ba:c287:a406 with SMTP id y24-20020a056a00181800b004bac287a406mr5652833pfa.6.1641923683622; Tue, 11 Jan 2022 09:54:43 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f8sm23925pga.69.2022.01.11.09.54.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 09:54:43 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v2 iproute2-next 02/11] utils: add format attribute Date: Tue, 11 Jan 2022 09:54:29 -0800 Message-Id: <20220111175438.21901-3-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220111175438.21901-1-sthemmin@microsoft.com> References: <20220111175438.21901-1-sthemmin@microsoft.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Stephen Hemminger 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 Tue Jan 11 17:54:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12710226 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 83C58C433EF for ; Tue, 11 Jan 2022 17:54:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344898AbiAKRys (ORCPT ); Tue, 11 Jan 2022 12:54:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344832AbiAKRyp (ORCPT ); Tue, 11 Jan 2022 12:54:45 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 796F7C061751 for ; Tue, 11 Jan 2022 09:54:45 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id h1so18368291pls.11 for ; Tue, 11 Jan 2022 09:54:45 -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=VxcROO/YL7z1OeGPOjZVYFxIeHXhPKmelOrqJjV/+sw=; b=ugTKXt3bvC+7cdTkk2x+y9er57F2R2ECwGsgWQJzKgCsY1ZqiP5xcejAv69F1HQxlJ SzkyWwYZwWdwQOX3n7D3Q/zcw078l0MJOMZz89eAMw/VEH6Xngcky7GxItw2GNmDgQBR 8yigA51BJlgZAwwUhIZQcxvM7Aps+Wzce6636a9T9w8SPRf9w17MFhd/6t03MNzMlzER n24ftvpcpBSvv81gvwrxvgJJB2fmj9lEzbykShEDBlsJR+FuJOk2RTo++38yB+Eke5Q6 tGdUf93uURcaMMWmaERqmFyL0cnkLhFm6RGx1Dr64P8s4Wy5nUG4AwKQei1Qcim9Z6Vh b2Eg== 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=VxcROO/YL7z1OeGPOjZVYFxIeHXhPKmelOrqJjV/+sw=; b=4yCap35wBtyw1H4RSoHDW9hvx7O5cly/6dCU4YGGyJh/3hYaERSXI0tFLTHXEhMTgB gTblGqJeF7eieFsP+cTsxPVi7/999IrK0juITotyglT9fV2c2Ki5hQiuzOOGelIgRtS4 Jd5kMJdHRFJsmllZ0w8YMvDhL23aedJP/k7/K8h1LspfBa3GbLzuY1WTz0exKc10BTIo B2mSfLS3wR2xlCT/DAuu4HLYPVFg606fDid4+0KHRfk1bynyCYagy16x/zBjQpX46ooM Vy9En1OHVopOwdDXaPVDl6ifadKsFYj4nyAkFl6QAIQCc3tK7LkANEPgD8qjpjjInVeH iM3g== X-Gm-Message-State: AOAM532B7ycc9SVFKJU42qaspbnSr/uTptzzXZay8iQ3xGQWUCJvr9mQ Xzp3X7nzDcUj7oEWElqCjtcIoZc0xwZYSw== X-Google-Smtp-Source: ABdhPJx12iWn3Ssr9r7AUyGmM+bu25Jx6ehpiWFcoOt0xNi2u3VsipLD5xHPiyN2ySWwvbNYkLABTA== X-Received: by 2002:a63:370f:: with SMTP id e15mr4863682pga.230.1641923684628; Tue, 11 Jan 2022 09:54:44 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f8sm23925pga.69.2022.01.11.09.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 09:54:44 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v2 iproute2-next 03/11] netem: fix clang warnings Date: Tue, 11 Jan 2022 09:54:30 -0800 Message-Id: <20220111175438.21901-4-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220111175438.21901-1-sthemmin@microsoft.com> References: <20220111175438.21901-1-sthemmin@microsoft.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Stephen Hemminger 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 Tue Jan 11 17:54:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12710225 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 67B10C4332F for ; Tue, 11 Jan 2022 17:54:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344837AbiAKRyt (ORCPT ); Tue, 11 Jan 2022 12:54:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344769AbiAKRyq (ORCPT ); Tue, 11 Jan 2022 12:54:46 -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 67E32C061748 for ; Tue, 11 Jan 2022 09:54:46 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id pj2so192658pjb.2 for ; Tue, 11 Jan 2022 09:54:46 -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=8d+DsDwmdySukuhCezTmxH0T4hTAAmO9JWrNTsw04LA=; b=X2LamkwZUz4tzqfNj0h3XTKQUd9iEzFTuQKx7I9uzG3NJYUL6pyNP06Veyht2asB92 9p+CVFCceh0H+sKfrtOKjEGStFh1c+/8c/1RNhuawVZmE8qrLcLUGllog9R8196RUe2+ 1KwM6y1JYliETmeHmgiW2BpsC156XtOzk8UX04m4yqioEOqJToEmidto90aVywaGoobE Jz5WmkNCaPrM9tMBS2zyU84aqdgT5dTyy896cqA1dNgMEk20A9MV01YqLJkb6miRVIpy YDAHBRj3HViYigIG3HqV9oIEv9nFfK9Kt5JHL7sher6aFuheGKp4AAey77yPXjtqCNmF dPsw== 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=8d+DsDwmdySukuhCezTmxH0T4hTAAmO9JWrNTsw04LA=; b=rsR9vAkTxEVzU8eMOufIylWp88pUL6iq5r6RscaMQd7RPTtDSriqMA/C59fvB0Q6e8 1xKsMUiFWDmaX6K8fCeXeSpSaKNOJx0r+hIyoIr0gaxOXbbWz1SDgQhfF7tlVDG72/iS Dpl6MRZvEPkLLt/o4+Q20KaoWyw9DP9XRiVqjknlW5Ws4pWf4qrMuw1P0o5MHwl5iXns yrNak1Juh+LJiizIceTpxtuaSc67fB5UMdlNglrJdw74k+PGtaWeJtQcPhE9ruBNYFLQ /SJ+J9XO+7j28beNGOA/b5oSC5JVCuleeTbStr4GuCun/X4/1JMwRHDUD+BzykBwUqnp 7TAw== X-Gm-Message-State: AOAM530Ld2rhl6VETCE49cL2z7AIeGXcjkFa3hk0GtqEMCB6ZTbvrvEw r1XnqAW2DJh3hjKEKYZ9cDEdtiRoPljoeA== X-Google-Smtp-Source: ABdhPJye4f9Z/gq5CYzJk3QWvf6lEKM3NG/fBnYO6fgaYc9+6jQu9dDipvzf3BcGBUTEhDEx6xHmdA== X-Received: by 2002:a63:6e4e:: with SMTP id j75mr5081469pgc.293.1641923685590; Tue, 11 Jan 2022 09:54:45 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f8sm23925pga.69.2022.01.11.09.54.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 09:54:45 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH v2 iproute2-next 04/11] flower: fix clang warnings Date: Tue, 11 Jan 2022 09:54:31 -0800 Message-Id: <20220111175438.21901-5-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220111175438.21901-1-sthemmin@microsoft.com> References: <20220111175438.21901-1-sthemmin@microsoft.com> 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 | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/tc/f_flower.c b/tc/f_flower.c index 6d70b92a2894..1dcce8c4aa95 100644 --- a/tc/f_flower.c +++ b/tc/f_flower.c @@ -1925,10 +1925,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; @@ -1950,8 +1949,7 @@ static void flower_print_eth_addr(char *name, struct rtattr *addr_attr, } print_nl(); - sprintf(namefrm, " %s %%s", name); - print_string(PRINT_ANY, name, namefrm, out); + print_string_name_value(name, out); } static void flower_print_eth_type(__be16 *p_eth_type, @@ -2064,7 +2062,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; @@ -2096,9 +2093,9 @@ static void flower_print_ip_addr(char *name, __be16 eth_type, sprintf(out + done, "/%d", bits); print_nl(); - sprintf(namefrm, " %s %%s", name); - print_string(PRINT_ANY, name, namefrm, out); + print_string_name_value(name, out); } + static void flower_print_ip4_addr(char *name, struct rtattr *addr_attr, struct rtattr *mask_attr) { @@ -2124,22 +2121,19 @@ 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_string_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; @@ -2151,8 +2145,7 @@ static void flower_print_tcp_flags(const char *name, struct rtattr *flags_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_string_name_value(name, out); } static void flower_print_ct_state(struct rtattr *flags_attr, @@ -2239,14 +2232,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 +2332,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 +2422,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; @@ -2452,8 +2442,7 @@ static void flower_print_masked_u8(const char *name, struct rtattr *attr, sprintf(out + done, "/%d", mask); print_nl(); - sprintf(namefrm, " %s %%s", name); - print_string(PRINT_ANY, name, namefrm, out); + print_string_name_value(name, out); } static void flower_print_u8(const char *name, struct rtattr *attr) @@ -2463,14 +2452,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 Tue Jan 11 17:54:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12710227 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 165CCC433FE for ; Tue, 11 Jan 2022 17:54:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344874AbiAKRyu (ORCPT ); Tue, 11 Jan 2022 12:54:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344887AbiAKRyr (ORCPT ); Tue, 11 Jan 2022 12:54:47 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CDC1C06173F for ; Tue, 11 Jan 2022 09:54:47 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id t18so8862617plg.9 for ; Tue, 11 Jan 2022 09:54:47 -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=OiqrohovM9zfns0nWKmPYHs0XGQKbvGE6s/wwEeSu40=; b=si0ZRhnaxHadh84EjFcDgnhI2iYwvd5CVG0DRShjMNfaonPqHOkE4zpjzAI81tAoAy YfrdJPu98XSuOYC2MxsLxgS9Ev59nmrv0CwDlQe27pDsHZtLc+BPON7zDrMPM99+v3Sy TdkAwHRvwfC3K/7101LWjXqNp1DJdqvfMyH/qSbZ2S6Cee+PfljiII/+Uq2tHBW+oo+o vchPjmKNcRols5wRRr9bFbOkwoR/zqDmQR3kGE2WzrgFWIztr933ibXKeJlFeQM+sh4u 71l7SyZS/J8R7kyVGwKLyDmJ5szd4gPNZZPDZLWKn8r9TVI57RqMELinnmVOOS9epm49 CIug== 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=OiqrohovM9zfns0nWKmPYHs0XGQKbvGE6s/wwEeSu40=; b=BG1KUEtzP1rK05NM7NQ6qgy509wZn6urBh0fHXIzyi5EVe47t2PbiF6kw1yIeVZdZc g9LKFY1bRB7NPk30feTuef1V2f9JZso8zXzLR6b41Z9qgNG9EQqOHf4XJsJe1dw5vjcT 3GEA1NIvUNPFAeLZw4BiMO+rseJ15DBoRLdqSMtusOHMQMaB3kafFzWLH/iaCBHALtZn q+zoD8W9eAXQYpvneFe+I6Y8dtlxlu5yf9RKXTCp+pDF9bE5EhlI6WfSexZhe2AG0Q3P F7+SLFv+iQx+wIugSgJnyT5/81tbUv6H9CBN0SGmas5bjB7yUeogceaPbgDNx1FBdw04 bT/w== X-Gm-Message-State: AOAM533KE6T0sMEj7IM35Ek61I7IAdzRgeIL5th1RaFkE2IdEMn2VVv1 azal369wEJdPyfc1i6yoLfMnrGSxpfj3nA== X-Google-Smtp-Source: ABdhPJw2q+10dTVAttRGZmS2BDOtGzrbXE+8amf5se3safuNScoDDORTgRkl0lLNJ1FKlbHIAJtjgg== X-Received: by 2002:a63:7f53:: with SMTP id p19mr2900796pgn.321.1641923686503; Tue, 11 Jan 2022 09:54:46 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f8sm23925pga.69.2022.01.11.09.54.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 09:54:46 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , elibr@mellanox.com, Stephen Hemminger Subject: [PATCH v2 iproute2-next 05/11] tc_util: fix clang warning in print_masked_type Date: Tue, 11 Jan 2022 09:54:32 -0800 Message-Id: <20220111175438.21901-6-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220111175438.21901-1-sthemmin@microsoft.com> References: <20220111175438.21901-1-sthemmin@microsoft.com> 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. The old code was doing extra work the JSON case. JSON ignores one line mode. This also fixes output format in 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 | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/tc/tc_util.c b/tc/tc_util.c index 6d5eb754831a..67960d2c03d7 100644 --- a/tc/tc_util.c +++ b/tc/tc_util.c @@ -783,7 +783,6 @@ 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; @@ -795,26 +794,20 @@ static void print_masked_type(__u32 type_max, 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)); + print_hu(PRINT_JSON, name, NULL, value); 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); + print_hu(PRINT_JSON, mask_name, NULL, 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_nl(); + print_string_name_value(name, out); } } From patchwork Tue Jan 11 17:54:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12710228 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 85CD5C433F5 for ; Tue, 11 Jan 2022 17:54:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344903AbiAKRyv (ORCPT ); Tue, 11 Jan 2022 12:54:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344893AbiAKRys (ORCPT ); Tue, 11 Jan 2022 12:54:48 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45816C061756 for ; Tue, 11 Jan 2022 09:54:48 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id 59-20020a17090a09c100b001b34a13745eso6653673pjo.5 for ; Tue, 11 Jan 2022 09:54:48 -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=WRBg2ZXGKa7DXYywQUYT3lQxRWcELX8oSpi8YeIwyL52CMvhoOxhoKcZOba0cf3vyl fVM1AXm/OtrYo5SjMpV/RU6ik3MZrU59fHMEVihjZEOJq9UavoXlWXC/8VGN8g413zbO TvTyvgXtb/0WLSQMXAnpwF/AdjYZGb1OME/ySzIuBLJPzP7eZAi++D7DItEG75tzfIDO X/XG8y4M1wTWcvOtguc7oY1hUTechwM/FxvmkzAN447tpsDT9ZIZ1J2tPEXplO5WYOz3 TLSceFrBzwS/EKPkzGdz1XMC/Ob147XiDJKY9HW1W6v+iEpq//JCbG1e11uo5qaHqURO R8pQ== 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=ltnCpALmWfi6KpA3Bhb6KctNa/BvHawLgFWa2xSq9dFxnkaq2Cwl0mZAj3GHxiHsla fCv7lRtGMRjO/j9xt7Ty1IpYd+2lCsFxfdOcOvIhHq7ZdIvaLJ+hqAMm7A/7eT7cZcXH YTHo+CudDKQ0T4186xkFEYY2f69jeTJusQ1WMJuLgia6glV5eXgaHXmJ8p13cN2UqQIS P7897psYghgDEVsnaaAEOn1iALMF7CYC13XVI/2uiaZLEPfMTEernQHAH6xRNTZL+OGS A+pTOxsrjIpF1ydWoGHsrh40K4046TfGensPCvD4J+0HUmCFS9Ly03qwjqXYsA4Tycm+ p7wA== X-Gm-Message-State: AOAM533ZiBdZpiQqGZiEIHi84OZmYOeSFWtFd+fnZDZQnCrUuXqZ4OxQ epbdJI9RMioPYAjVr9uS0ooeshvoptZc1g== X-Google-Smtp-Source: ABdhPJz4opmvdc2UJJ8QyPv3MSvcJTCaZjVSGpYsYgnkYw/fgpMHp0BcMScqTIQzC/DST6sJ+MpqIA== X-Received: by 2002:a17:90a:7786:: with SMTP id v6mr4397378pjk.11.1641923687440; Tue, 11 Jan 2022 09:54:47 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f8sm23925pga.69.2022.01.11.09.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 09:54:46 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , Stephen Hemminger Subject: [PATCH v2 iproute2-next 06/11] ipl2tp: fix clang warning Date: Tue, 11 Jan 2022 09:54:33 -0800 Message-Id: <20220111175438.21901-7-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220111175438.21901-1-sthemmin@microsoft.com> References: <20220111175438.21901-1-sthemmin@microsoft.com> 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 Tue Jan 11 17:54:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12710229 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 8F473C433EF for ; Tue, 11 Jan 2022 17:54:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344900AbiAKRy5 (ORCPT ); Tue, 11 Jan 2022 12:54:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344769AbiAKRyt (ORCPT ); Tue, 11 Jan 2022 12:54:49 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A2DC061748 for ; Tue, 11 Jan 2022 09:54:49 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id h1so18368563pls.11 for ; Tue, 11 Jan 2022 09:54:49 -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=/oE5+nHZ47hf0eq1B8VOPvwAM1+8jomIksNPwOnPNNA=; b=NJOry5YTyGOUnXe/1/j2hK0F60ua7ZI98hiaH+DoxszNCVWEtfVwzTQIfTSVCENMf8 GVm5Bki15lVtaEE9/6U/rRObFvNGboDUYzLmebOZr9ybxJY8d30JQfGZiFI/4JOyXeYc thGFtLbgCGilsUStjBPNjqF/64mtfjfOv/oIidcEmVcIDTF7Q7mIxX0o33oxeWI114NI vvr82QthAGGKkOlQjNdJqDAlmp/F/fLgyGA3EsQ1JUE501wW6I4rucOsoXHmUot8QY7/ etISnWoDXAU04CpO3VQnyUlIOsv94Bp6SieF1mPVJX4Vi3BjVf4wPgNWroXg3Bn2oSDJ KLJA== 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=/oE5+nHZ47hf0eq1B8VOPvwAM1+8jomIksNPwOnPNNA=; b=GMmaQ50kjR5u8qqJmKGWkAvhUuNFEij9QzqHN7ts3wEmD89UuWQd2MYB+Lg6mEpIjj P8rRq0XRD8vV4nF7K3pArBtLTygcxj8r7ct4tmE5gUdoCQGds7T2Tx2OMHmDSfEpDrrO qR+B1GA1YHE3zEEvuh/k7GgbTOvPqEYtaoVHQw1EzyY+3lN59RUiEJlkT15ZFb+Ki7wm JBBBUOgIwnYVuRsM/m0+DrBqtqRSnHKmFbCdTY5EPNBCsFYq4m0DU1v+dSWa59FOkTWY Ae4g9IGSpEUWMrhWqGRw6EUOEZVkIE4+fGfrLY8Pbl4f1QgD6+RnHsUSUhf7RP4BCUt4 o+aQ== X-Gm-Message-State: AOAM531ra9QkaCfmkKAmMDHqJNIcgNtMeUW7yLm+TNaifBQa81+iSc7q Gb0xL/Ronz3wolHCgkbgOhd9p6EuZWRJdA== X-Google-Smtp-Source: ABdhPJyJPp21hIiScw+VsAH/v+SDTGq85u6XOpwJEyc4bh35QFfpQ+sp08O4aNyEDLYw9JLf3WoZuw== X-Received: by 2002:a63:3f04:: with SMTP id m4mr2772831pga.326.1641923688647; Tue, 11 Jan 2022 09:54:48 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f8sm23925pga.69.2022.01.11.09.54.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 09:54:48 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , Stephen Hemminger Subject: [PATCH v2 iproute2-next 07/11] can: fix clang warning Date: Tue, 11 Jan 2022 09:54:34 -0800 Message-Id: <20220111175438.21901-8-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220111175438.21901-1-sthemmin@microsoft.com> References: <20220111175438.21901-1-sthemmin@microsoft.com> 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 f4b375280cd7..67c913808083 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 Tue Jan 11 17:54:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12710230 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 04745C433F5 for ; Tue, 11 Jan 2022 17:54:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344887AbiAKRy6 (ORCPT ); Tue, 11 Jan 2022 12:54:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344899AbiAKRyu (ORCPT ); Tue, 11 Jan 2022 12:54:50 -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 50C69C061751 for ; Tue, 11 Jan 2022 09:54:50 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id w7so18347285plp.13 for ; Tue, 11 Jan 2022 09:54:50 -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=voBmFCj2+ctsMRkYmn0CD07t5j/B2Ddl/W4ZGUOIMLDokDlMGLn4mk+vINk5OL4LwA DzgvEt7a4oo2DyIFPtkR95qtCTnhmVNx5bCPWEwOeOIub63FHviSPt837g3yhVejcWh9 v9+ZMQcFsVDw3d8mXe3NRW6+eoKBlyTKTmxaNF0zFtf8/Uv9HTFG/dg7B5ZmUEveGVlK MWnPsn2AO40sDuPisuj3WWJrPG59yf+4g2j4p2QMum0P+FO7mF6TiECO5tFrhmYBywRg B2E6qjempVMkR85/zVF38n0QXM43vNFXVt+PwOLiesb2VWKiORWvq2ZCceJh3NCVRuHq hP6Q== 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=VALtkX88FxQLU+nvVwN+7PSNo0L/1fJEG9aiXLH4bdFbCdfhivnI9Af0hWJoBztx7F CNu6+OkkOu1YGeQF9eNVtTBgpw1Ux87B9snf/7XjKSKrft/3BRL/FrxCTFxeNmL1o4PM GvnzaiK1s6B7d3QfssuwknSu1nbRh6YrgKP3EdWdiRRUbdU+OcDRjoqK5uWTSjTNkk62 Rw7clkAlcJf7NiVTCfPtxrI6+R1/qMvfQ4txt+v0uevAkZl90OcShAGCoX/hLB3gBySl W3r8+wldO90O2CI3lFITY/qrLkzFFLvK4Pz84dXvyZg9kyHkh96SJ/zodfyB7Zj8D1VL m3YQ== X-Gm-Message-State: AOAM533nG9rDhmVSx83MFo05wUUO3Ka1stikC6mSKJsVw1DD1O/K12m3 jtsUsCeyl/CYfpq/SQ+J3DHsde9ODncGsQ== X-Google-Smtp-Source: ABdhPJwf2bt8mR9Bfiek37m0Rb79spqX+lXllvD/xPKuxHq7HLVuKLaiPKERPi8MMXq++13oW3ZrWw== X-Received: by 2002:a17:90b:1e50:: with SMTP id pi16mr4388785pjb.118.1641923689553; Tue, 11 Jan 2022 09:54:49 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f8sm23925pga.69.2022.01.11.09.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 09:54:49 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , Stephen Hemminger Subject: [PATCH v2 iproute2-next 08/11] tipc: fix clang warning about empty format string Date: Tue, 11 Jan 2022 09:54:35 -0800 Message-Id: <20220111175438.21901-9-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220111175438.21901-1-sthemmin@microsoft.com> References: <20220111175438.21901-1-sthemmin@microsoft.com> 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 Tue Jan 11 17:54:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12710232 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 42860C433F5 for ; Tue, 11 Jan 2022 17:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344894AbiAKRy7 (ORCPT ); Tue, 11 Jan 2022 12:54:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344907AbiAKRyv (ORCPT ); Tue, 11 Jan 2022 12:54:51 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21007C061757 for ; Tue, 11 Jan 2022 09:54:51 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id y16-20020a17090a6c9000b001b13ffaa625so6715528pjj.2 for ; Tue, 11 Jan 2022 09:54:51 -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=PsvdTqbhqt6fDLNJxGBf0YgetV/tZW999PPm+FRuyGo=; b=JwmwEJjt372KiiJ30TnJlzt4WpfC7ep7zc2bfN/kJS9S+N18VDyTAAD158cwCo2CWv 93CDo9sM245aG3Fz3t+BqjPAuKbJaCWJabKIBNKLvan9cyGOB/iyC7FD8WZO0r/fb3pM w0jLNZP9swK9SoSloxTmlW5KTgaZNBj8h+Vk3mO9BOrkdshTf2GcfTn9g2QWCcIVYz8B DrzmpIATEAWFO1w5a+EAHVeDDFGGAgWyDw3mMsnFPhroTbcOITUNC+7ZdLU846PYnk64 tYoGWpe9ImAajGgDPFOaDXkERw1O0PscL3vJXxUZB9wSpclf7d5NDSGQp373Gj3h9g1G sGuw== 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=PsvdTqbhqt6fDLNJxGBf0YgetV/tZW999PPm+FRuyGo=; b=jIOFC1RJF5Bxe95evAVAIvBROOnw0a8jMBhFpmsXRwaYF02ObptafAA4gMm8rpVzqJ IBns9+9l5XBpTOeuMgM/8FqUWc7HmzsxQSjlVWOS7HoWknM3tTQolMPnYwcr0H72Tkzf yDfKcJ9kzOkZM8GCcuxiG+IYgNAfPqVoNNM3kRD7fHZ7luMlYGQYM6X6VSBDNnE1Ar0J CbwwgitooHKPS0OTyWbiYdCgKmIp73jyyU2VBxBPcJSUDHzzt0UBBnuMR51DowvuLySB GJLPYKCTGgDduNFvJ164jei1vH5R1uI7hkaQXpbbquSiRASPae06XfzEAr64heb8b2Bb zU0g== X-Gm-Message-State: AOAM531dndUPIKbtzORh/tl3goXCRlb+z2YZd1ExfoVsKaDN/PKhqRYI 2lY060BaJlrHZekoiMGTilYrGba5Z2VyLQ== X-Google-Smtp-Source: ABdhPJzYBxYeBJDvryHoWmX9J8F+1x6vIzQZHgnj+bWUwyKRdbcULIsz6vmu7nMU+KjpJaXCyDolQA== X-Received: by 2002:a17:902:c9d2:b0:14a:3335:accd with SMTP id q18-20020a170902c9d200b0014a3335accdmr5574705pld.94.1641923690346; Tue, 11 Jan 2022 09:54:50 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f8sm23925pga.69.2022.01.11.09.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 09:54:49 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , Stephen Hemminger Subject: [PATCH v2 iproute2-next 09/11] tunnel: fix clang warning Date: Tue, 11 Jan 2022 09:54:36 -0800 Message-Id: <20220111175438.21901-10-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220111175438.21901-1-sthemmin@microsoft.com> References: <20220111175438.21901-1-sthemmin@microsoft.com> 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. 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 Tue Jan 11 17:54:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12710231 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 93E8DC4332F for ; Tue, 11 Jan 2022 17:54:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344869AbiAKRy6 (ORCPT ); Tue, 11 Jan 2022 12:54:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344895AbiAKRyy (ORCPT ); Tue, 11 Jan 2022 12:54:54 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F3AEC06175B for ; Tue, 11 Jan 2022 09:54:52 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id q14so18389854plx.4 for ; Tue, 11 Jan 2022 09:54:52 -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=BzjPyT/RQIo7cUjP1ElelxKn4gj4X/NyiyI8TPryvlRB3N9ToRiQdb9X+B/ZOpdTOs wXkxTfeIRWxlL1QbwJcca4V6d/7kSBgQh0GvN7liNgOwBfoY+5WGrB+l7AossJRHuvTO xP1ZfUswRgn7kvsnGWBbWaXmSh/GTu2TqT75Wtwk71IbGqaJ9NhB4MAOekUMKnnIe35U CLp9aFzaEzLz5FJbJlIDpcDBivKfhxleebHpi5CngtEn7Kyn3Y32Bg0VglufmzW6LZi6 idt1c3cWND4nRPpqCNQzsiC0YEb1D0qigUzCj6fomHIAO8hOtM/D0RW3nTScAboPbtHb tURw== 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=fnet5LW8LRgZ8hyw7O3P3khf7h2gUCi9apMw6dqJfIb2VEdzuzoP109iCRJh2PtEav 78KbdszoyWw15+ZxKZvyoIqP/WSNktT9QPV3c9aKbBVwBdk+dzh3Wcq60uJM4IuUxPje G8hVdtRlWgfNTHgFAoz2tzOxpPHUeSd3+OHQgLYRcUBb3BO0asAlN7zAZitTWqDQ1fcn eDd30AbsaHuwm9tp36zLtuOTOfQor4ZUuC+QAIDy9xKdUQJvr9MhyvlgZZ/fiilLX3re gdPwDUwsgTldFO68MRAu1f6hCAkVKWglujX0p+tzwOI1F5+o974nq72jfp0HqGxL3OT9 NyMw== X-Gm-Message-State: AOAM533Zr6JIZLHVyhdkZd7putjGwfE0ROtqK9wCZRz3S6gdw/WiTjGV vk+deij9eCXMjqf2bv37EVcrRfIEn1nfMQ== X-Google-Smtp-Source: ABdhPJwWpOhFWiwN/jqk99sSGxXH3nZCHGbPTRE9E4yN+grBjfPtQsiOcyg0T5S8uLQoucfe8iO5jQ== X-Received: by 2002:a63:7c59:: with SMTP id l25mr5000226pgn.228.1641923691271; Tue, 11 Jan 2022 09:54:51 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f8sm23925pga.69.2022.01.11.09.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 09:54:50 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , Stephen Hemminger Subject: [PATCH v2 iproute2-next 10/11] libbpf: fix clang warning about format non-literal Date: Tue, 11 Jan 2022 09:54:37 -0800 Message-Id: <20220111175438.21901-11-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220111175438.21901-1-sthemmin@microsoft.com> References: <20220111175438.21901-1-sthemmin@microsoft.com> 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 Tue Jan 11 17:54:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12710233 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 8ECCEC433EF for ; Tue, 11 Jan 2022 17:55:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344910AbiAKRzB (ORCPT ); Tue, 11 Jan 2022 12:55:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344937AbiAKRy4 (ORCPT ); Tue, 11 Jan 2022 12:54:56 -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 1D36DC061245 for ; Tue, 11 Jan 2022 09:54:53 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id i8-20020a17090a138800b001b3936fb375so6728086pja.1 for ; Tue, 11 Jan 2022 09:54:53 -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=TKvyW1CxSmDrJRaWV+QQIO2dUVX4LQYIgEeEqJM0ZTQ=; b=ULtfXFJDKWaOVpubQ7eGnMXe2zGo97mwrhPDjODp3r6PYbE/IxBpr7if+gKI2wWSli sOZoedudwsrucRsXdayLe8xpOkFbOHOt7tUaH5q9qRIXez4Iq/DMlbxa89qrsJlNHaLR Zv35l1H0KDFNEOEc148xsvL6g4RmnoFDbOxs+AYvX4khxz7APTbfbLhTV3CNJJJMdQ1h Q3Xvz8J5aG+OC38ozmSzgjWHx3CZhgW548Ilcb9Cpty+8Od9Gh4VDbkTmNz6dJZqC1wA W5+G422ghtnLmI1CqVyAnfeUWlpiAiFJ0M40eFnqxJ/50WMyV8/kRklrwVXRXjHqy6F4 Sygw== 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=TKvyW1CxSmDrJRaWV+QQIO2dUVX4LQYIgEeEqJM0ZTQ=; b=pe8iW+0OnEKQyy7FBadgoRX434hCUIl+waRPbhDPuEQoYVTIVgAMGy6xDCG7ixO5Ai gdDsv7+TjwFckDc/98yCt5WWjzcWdpsD/b/PbPzBDaiGUQWIdim7delTbUMCDlRKNhBL vmlfZ2Fdx6GRVsqibM1GJBpGvHxMtHKm9GUmM4Lh2JBNCBYoyJXH+mXX8P0jdAsEog+L F70p3BqhIXNHwVawTHqC6DSmMGttoy3pXLZ+pDF0jr13kH0UF78azfXvajaWfDy6C8tw etoXsL05U97f7NmPG/L6JrGZco1zqhA2TVMQbSz0RKVE64Ig5BwKjsoLXdH7PDU5dij8 i5/w== X-Gm-Message-State: AOAM531Mav51h89dqBklCy96maGP4Ubr/hZGDK/x0KOd3q0G2f+xQC0x A1ovcUJZZ7ZQ8bd71LmVEJC4Dy8iqu51gg== X-Google-Smtp-Source: ABdhPJy9PsD8cvJHhiC4/7ZeHfyaUzoXKUwlU94EHJmsyA/e3+FtNfqlQmUQpXIaL0VCqiPD09kkeg== X-Received: by 2002:a17:902:7688:b0:149:5029:a55a with SMTP id m8-20020a170902768800b001495029a55amr5456765pll.15.1641923692292; Tue, 11 Jan 2022 09:54:52 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f8sm23925pga.69.2022.01.11.09.54.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 09:54:51 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , Stephen Hemminger Subject: [PATCH v2 iproute2-next 11/11] json_print: suppress clang format warning Date: Tue, 11 Jan 2022 09:54:38 -0800 Message-Id: <20220111175438.21901-12-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220111175438.21901-1-sthemmin@microsoft.com> References: <20220111175438.21901-1-sthemmin@microsoft.com> 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 furthur 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 comprimise 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)