From patchwork Sat Jan 8 20:46:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12707600 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 15685C433FE for ; Sat, 8 Jan 2022 20:46:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232825AbiAHUqy (ORCPT ); Sat, 8 Jan 2022 15:46:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232764AbiAHUqy (ORCPT ); Sat, 8 Jan 2022 15:46:54 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1807CC06173F for ; Sat, 8 Jan 2022 12:46:54 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id z3so8655760plg.8 for ; Sat, 08 Jan 2022 12:46:54 -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=mfpBL//YSgiacw4Dg7ggdjtgaZC9nKSLowcdk+KvtraqZBNp/YYVn5wvwqysC6VGb5 LqOliCousG0m2GuknH8Lx6sa4p3OwjQVpptuzuCEYLgUo7xrIUibU1smBJxSvUpDcdFT ZkuDmjVGUJqafmg26km99YhnrBc1/CFtxmnN+ZM6ESdA8CZqItx/vO/VXbsrz9UiBDdT BZclPOUgjcWvNI0i28gTo0fRwWpe5Fk/UI8gPERDJLJQoArnavefrbWs23Rm1xbweIuN PE4kWHcDXyw1+nLz6ivYynWn3Va2AUk0Y6tCFzqetHdYRWepPzxFhRMJdboN6IHwdzh4 uP4w== 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=bfmq1aS40Iz49z64fnfWlQaShpXZrTlI5bIv1KF87xfSMNAiJlE11RxiTGP+TkI8yC otwwVEaM9/okLGti/AYKUQOwYEtenAbwOJYTRL6ODsiV1tQjzgGn06BgCMd8irRpslPK ARyasjHhYwSZ8KkyOXjQsXZxTnEuV7Z2qS29/kkYyxf3Qb7UJjeZcBNkG6cbzakU8P/0 j8w3grgQfX8LIvc7zSl2TfxOmmwRjHq+Qt8F10IJNuw1qyHfK3HnkoWiMcMykszuGc/x ZYW3I7zsU9ASH5QWfXlnzICJQmJUjJwEp1y7NVnqVYGPuAEqW1EGdrvHfJbLoa81o/6Y gLjw== X-Gm-Message-State: AOAM530O5661g7KhAkSUB1moEaDAioat08YSfphMaBr/smSmlXH1cPS3 o4RH0Bth5zfNNN4Xs119A8CbNWboh0G3/A== X-Google-Smtp-Source: ABdhPJzjPxy6FknhEPngXVP9FEFBGPA+74tCQZkjxsGUoDd3sPSLCtbxr+srU6ecPR7m4xLUH6wV3g== X-Received: by 2002:a17:90a:4fa5:: with SMTP id q34mr3157890pjh.101.1641674813368; Sat, 08 Jan 2022 12:46:53 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u71sm2129393pgd.68.2022.01.08.12.46.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 12:46:52 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2-next 01/11] tc: add format attribute to tc_print_rate Date: Sat, 8 Jan 2022 12:46:40 -0800 Message-Id: <20220108204650.36185-2-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220108204650.36185-1-sthemmin@microsoft.com> References: <20220108204650.36185-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 Sat Jan 8 20:46:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12707602 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 203D9C433EF for ; Sat, 8 Jan 2022 20:46:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232833AbiAHUq4 (ORCPT ); Sat, 8 Jan 2022 15:46:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232828AbiAHUqz (ORCPT ); Sat, 8 Jan 2022 15:46:55 -0500 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE767C06173F for ; Sat, 8 Jan 2022 12:46:54 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id c14-20020a17090a674e00b001b31e16749cso15511002pjm.4 for ; Sat, 08 Jan 2022 12:46:54 -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=u+M7onowdXG0STrbSbB8ysKzsH67HxEGDkBe5jXLr3U0oI81B6aEE5Dl46zA8Q7r6v Y3pY8KjjA4KWV1avYrXR+tLbo6gJv3zN+q2NaJGBwtfx7JenfOrAQswxZW8b2GAmmu+F bVgFNeUeXuakKrUnsnVlxmIkCfFhRd4jCOF6GSQTsSpkcoFvkVBsgdGH9I1FXvTX2MmM 3HDUqViGzuk59W1+tgiBIJAZ+bnzk76SpSZd2tEhcnxXbruKz3qViwgxiJFB+dDQ4i08 p9PkUiJMcWh4EYblm6JsPfBD3YQ60/2J0xWq53rBXf0MIqhh4E46Xrp4/knl89vLmfEP OepA== 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=k3/HDldizhkHz+NlDeVCz4A2tfghmXm92iMBtPxHUHp65QcMBzIhgNXW5DtzOGEEXS eUOEKta+jd0lzz/L7iY3t02w8LhobwvBRLJ6sShPyUptQ/OKsu5ZDTBf/Qd5EDWskbru DbeHtk5T/Z8IIk9W/cuV/pKGg+if/srMRz19cPHPNTS/d0qAerwDAxeeoy46hWQKv6q1 NUWcb+0gYJ2nXWwH6nQ1U7RHXtPLo08/s4DsE3bVtwGOnii2stf7KaO1oSm1trN6gwoe ZFzmhaUKDeZQkLWRTSXAQswjYvpO6ifK6r/RNTiy8GJN+wslfsCv5yuH6hepCdHPRRyk yEng== X-Gm-Message-State: AOAM532nb9uAVB/DZCyo5evef7eFGO3lMeEQUkASw2ZYu6W3DulCZYPu 3z2fBmhNXpbttCnsEigk4AUjk6gT5ImF5Q== X-Google-Smtp-Source: ABdhPJzGT6M6ESUmn3e9MvM4R7yDXn5QkJevozGVV6KEF+oMpEsQ5NPgKorQqP39rT6dXSfUOZZI2A== X-Received: by 2002:a17:90a:1108:: with SMTP id d8mr21567035pja.175.1641674814245; Sat, 08 Jan 2022 12:46:54 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u71sm2129393pgd.68.2022.01.08.12.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 12:46:53 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2-next 02/11] utils: add format attribute Date: Sat, 8 Jan 2022 12:46:41 -0800 Message-Id: <20220108204650.36185-3-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220108204650.36185-1-sthemmin@microsoft.com> References: <20220108204650.36185-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 Sat Jan 8 20:46:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 12707603 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 36F38C433F5 for ; Sat, 8 Jan 2022 20:46:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232831AbiAHUq4 (ORCPT ); Sat, 8 Jan 2022 15:46:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232830AbiAHUq4 (ORCPT ); Sat, 8 Jan 2022 15:46:56 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4F6FC06173F for ; Sat, 8 Jan 2022 12:46:55 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id x15so8677454plg.1 for ; Sat, 08 Jan 2022 12:46:55 -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=tRABf8EeIm9+Q/rBzJCHrAOkSrCfiIGyD4wmbPFWj0wII5O4qmLWG8I//HYJ1RGA3C R2ZvG05pFNv/C1/h7xodEGbr3sIghA59h9qO3Z174pvNEQHNVppW5B9VyNluX4O/jhQv WxS++g0PEegHxMkL4rRSQp3HCE56YLwU9/ZQjR7+9sXxSigRcCyXPDJ6AP6Ge9SI+Cyk 051/UYuEuxBOwML9wCnifv1RMsFLIoUD7mH+jhkzShhDSmwQhmki8J4+i/5fnn6p0q6s RetWtNPVGnBN8LKzUEsIeE7Hx2aDP93DtHUjHXCnxYyN1GJkjY47YofVYa6Q0DVvZJA9 tmwA== 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=OT/ebtXrvHvGXBwyjv73qAC2f6s/8N2vx0OeR0kCpOjzZ3bWEVN1bCtVr0kg4H7Vn5 tIgiQgKnCEYuVA/G22ova3ZlNTAIRT/KXcrL61LnhLtw6N8LsFQZHa+FcmJacE1eyvT+ G8XRpgatzs3egrxp/KRxVDAKk29XEKa8r8VteLNsEz5LtlsAe4NB8dGwSszDIom2GpVn OJTEYrr6OJarvMETSPTPvsNSS88RJxMEyH/XDD/XJQ++6Uq9qwJiYiXB1BhBLUucXAVI SEHzvj9f56m0qV11KMOEaPGqarxXRMsQqQsmjIRBE76b+hzL1tnyT4WKjbsq0bTSD/WQ oPww== X-Gm-Message-State: AOAM530VMCx+QX8DUgCPAB50981lYoY44BpkioXuS44O5JjDY9NDLAxI 1WLIEWuyDmHD97W4Pq5svc5wTW4oOIBg+g== X-Google-Smtp-Source: ABdhPJwhuWzlXkLP6wGYhUP87Qjkw0D9JnIk9lSe4IOZ2I52QWrnS4zqTT8QI7gPZNsPgpV5GP+BXg== X-Received: by 2002:a17:90b:4b8d:: with SMTP id lr13mr22538335pjb.0.1641674815023; Sat, 08 Jan 2022 12:46:55 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u71sm2129393pgd.68.2022.01.08.12.46.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 12:46:54 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2-next 03/11] netem: fix clang warnings Date: Sat, 8 Jan 2022 12:46:42 -0800 Message-Id: <20220108204650.36185-4-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220108204650.36185-1-sthemmin@microsoft.com> References: <20220108204650.36185-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 Sat Jan 8 20:46: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: 12707604 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 656B4C433EF for ; Sat, 8 Jan 2022 20:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232844AbiAHUq6 (ORCPT ); Sat, 8 Jan 2022 15:46:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232836AbiAHUq4 (ORCPT ); Sat, 8 Jan 2022 15:46:56 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98FD1C06173F for ; Sat, 8 Jan 2022 12:46:56 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id w7so8625035plp.13 for ; Sat, 08 Jan 2022 12:46:56 -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=oE56p6dh9NZJSgcsByBhA6EECdcU/rGK68wqrYdFJ6c=; b=yIhQaifi4/nMnCqNKLvP7ShaWqySYwAFyNfsoiyO+7JJbdfHUg6D0wt1hZRG9dlhMK swNcatOuDGxD14XdN6vHcsMkjY2VbIsZnp/fZsati7MZTh8R0gs+TX5wtoZRv4ado537 lSN/E7teE8fkN1EcjuTJLH2/tfqHsywqpiFWLCkobTTygaXELS8TQe9znPEV8EXAQ3Gk kEY5pUEPRDWHQQE/PEqkv9Vf5iKIhfFmj6I365jAnPvXLmy2URL+7tN5QDoe6TFJbrVq Z7dGYn9fER4cU8gyXb7NLlp3xqq3xSv5VQL6lGgvUvMBDW3whAode3G6IOtVBRQGXUO1 zd7Q== 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=oE56p6dh9NZJSgcsByBhA6EECdcU/rGK68wqrYdFJ6c=; b=xwqfBXkQXJK/kTj7AICspSv+HLbdcSwvOP0TFlpYZXWtwLkKaTnTKW2btR3NIbdJTJ q9ar/fjqaPLBjKbYeGI2R0R0mq38VzsKGXvqy4ZuG4SU8Mr2Smt3idwt1wCSG2ORsYXm QOtawe1/koQxsLGlJuCHP9QswBC7nYRtc5tXfuu3Jw0RIP1Y5HBZRMw7r4aKZXPqja/d BLPW0iYco8R3aIOjPUPeUrB4Oinh2CwGkyLma1/cZE/cIB0A8ek4dTRfdaOWotS9r0Hj UV9ySEsx39VddMtpq+Z+e0hoTuYBre5HW0vNTq7/Gs+o2XqA8oc5+yJyuN2UWlXQ1Px1 aMlA== X-Gm-Message-State: AOAM5300CVB9HdcmB2YXZOmSeA9J1hpRAxuos30ZXg+kEuIjYro7xkjV +fE/7hd/nBd9xzlP72BdPxmiu1dz2Z7FlQ== X-Google-Smtp-Source: ABdhPJy0e6687ucK+wJllEkwc0zVHzNkG77s8y8v4G+QxsatbQwsJPXXx0n0y4K5pjw0lvHOk6zgSA== X-Received: by 2002:a63:b949:: with SMTP id v9mr21984879pgo.79.1641674815811; Sat, 08 Jan 2022 12:46:55 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u71sm2129393pgd.68.2022.01.08.12.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 12:46:55 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , gnault@redhat.com, Stephen Hemminger Subject: [PATCH iproute2-next 04/11] m_vlan: fix formatting of push ethernet src mac Date: Sat, 8 Jan 2022 12:46:43 -0800 Message-Id: <20220108204650.36185-5-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220108204650.36185-1-sthemmin@microsoft.com> References: <20220108204650.36185-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 This was reported as a clang warning: CC m_vlan.o m_vlan.c:282:32: warning: converting the enum constant to a boolean [-Wint-in-bool-context] if (tb[TCA_VLAN_PUSH_ETH_SRC && ^ But it is really a bug in the code for displaying the pushed source mac. Fixes: d61167dd88b4 ("m_vlan: add pop_eth and push_eth actions") Cc: gnault@redhat.com Signed-off-by: Stephen Hemminger --- tc/m_vlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tc/m_vlan.c b/tc/m_vlan.c index 221083dfc0da..1b2b1d51ed2d 100644 --- a/tc/m_vlan.c +++ b/tc/m_vlan.c @@ -279,8 +279,8 @@ static int print_vlan(struct action_util *au, FILE *f, struct rtattr *arg) ETH_ALEN, 0, b1, sizeof(b1)); print_string(PRINT_ANY, "dst_mac", " dst_mac %s", b1); } - if (tb[TCA_VLAN_PUSH_ETH_SRC && - RTA_PAYLOAD(tb[TCA_VLAN_PUSH_ETH_SRC]) == ETH_ALEN]) { + if (tb[TCA_VLAN_PUSH_ETH_SRC] && + RTA_PAYLOAD(tb[TCA_VLAN_PUSH_ETH_SRC]) == ETH_ALEN) { ll_addr_n2a(RTA_DATA(tb[TCA_VLAN_PUSH_ETH_SRC]), ETH_ALEN, 0, b1, sizeof(b1)); print_string(PRINT_ANY, "src_mac", " src_mac %s", b1); From patchwork Sat Jan 8 20:46: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: 12707610 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 89A42C433F5 for ; Sat, 8 Jan 2022 20:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232850AbiAHUrB (ORCPT ); Sat, 8 Jan 2022 15:47:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232838AbiAHUq5 (ORCPT ); Sat, 8 Jan 2022 15:46:57 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62B50C06173F for ; Sat, 8 Jan 2022 12:46:57 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id b1-20020a17090a990100b001b14bd47532so11402216pjp.0 for ; Sat, 08 Jan 2022 12:46:57 -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=oo58f/CDxEDICbVKNpq8KMWLTQGVgfPS6SqpLesaoss=; b=eHqaZkE2bzVQ2XCHQOl7+5DNGmk+se2kvJYmmMHohcZLOHTaK1oymRISWVY6G60+uf InWDgZh3zTw7TLbHdMzVOv6zpbcDj+KtZO90/3k+mhUbUX8glfEJ2bRAw5isR1KxhnLJ Wdha32dGeRsS56RXcAF5Q1NQvuy6n60fidxe+k0M3m6zlPFHqZ1sf04xMe91KT/QN7WR s8urnRXVeJKir6r0SiCHsaew6oB3dgl7bZiRr1tH7lugOCxVLyicHFcUBpd5j6WQx3vL AX7ZMMxmIaqiiqGN+oLEbLUKqto8Qx0nSxG557NKKFZBIlsicobo8KPIaT8d7jccFRUm Bb8g== 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=oo58f/CDxEDICbVKNpq8KMWLTQGVgfPS6SqpLesaoss=; b=30r9yg7k/ivt4UoiOnaOOURHxIHREne9s4l4iYC8bFrAFUDTkEDZJbv0eDCYQ/RgsS MLwTr3BGzV6XGiEm3haWH0rVIGKfkyZ79pisA4IlIoBh6af6lnVvMAuPYMaad38DxTMP rYejxn+XKqeQMTuUSdGJnUBkEzM08PkaSbEofUjuAnmkkjvPeWqiv23Adhr03Q1af2NV gmMi/oRoN9WhQ4e0xqPGzZyDl10rz2hgMrkq1kc7GtrtaizLjrVf8wxZrTedIoIMfwtL MavIOB1cM08PkiKpVGgRKW7/ERGJC6L0nbwsdcp2PzFSrJwO2jh3JLNC1qZ9dkjOrzRl 1TSA== X-Gm-Message-State: AOAM532XzYWSE4E6l4Dygv8NYmwNsLLkncrVkzSc/ZJK4iV8XOcY5SpE 9nDTPiDq+f2r8dRqYB/Cyn+pjPyqIhLRoA== X-Google-Smtp-Source: ABdhPJwJ8pqqmbU8mfZh1IKpgxqsZc5SzFlZSFF61l/hODQeZSiA7I5wxW3pNy3B8nLmydDlq/GXAw== X-Received: by 2002:a17:90b:1c8c:: with SMTP id oo12mr21988369pjb.148.1641674816553; Sat, 08 Jan 2022 12:46:56 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u71sm2129393pgd.68.2022.01.08.12.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 12:46:56 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2-next 05/11] flower: fix clang warnings Date: Sat, 8 Jan 2022 12:46:44 -0800 Message-Id: <20220108204650.36185-6-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220108204650.36185-1-sthemmin@microsoft.com> References: <20220108204650.36185-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 | 62 ++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/tc/f_flower.c b/tc/f_flower.c index 7f78195fd303..d6ff94ddbefb 100644 --- a/tc/f_flower.c +++ b/tc/f_flower.c @@ -1925,10 +1925,17 @@ 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_string(const char *name, const char *value) +{ + print_nl(); + print_string(PRINT_JSON, name, NULL, value); + print_string(PRINT_FP, NULL, " %s", name); + print_string(PRINT_FP, NULL, " %s", value); +} + +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 +1956,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); + flower_print_string(name, out); } static void flower_print_eth_type(__be16 *p_eth_type, @@ -2064,7 +2069,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 +2099,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); + flower_print_string(name, out); } + static void flower_print_ip4_addr(char *name, struct rtattr *addr_attr, struct rtattr *mask_attr) { @@ -2124,22 +2127,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); + + flower_print_string(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 +2150,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); + flower_print_string(name, out); } static void flower_print_ct_state(struct rtattr *flags_attr, @@ -2237,16 +2235,20 @@ static void flower_print_ct_mark(struct rtattr *attr, print_masked_u32("ct_mark", attr, mask_attr, true); } -static void flower_print_key_id(const char *name, struct rtattr *attr) +static void flower_print_uint(const char *name, unsigned int val) { - SPRINT_BUF(namefrm); + print_nl(); + print_uint(PRINT_JSON, name, NULL, val); + print_string(PRINT_FP, NULL, " %s", name); + print_uint(PRINT_FP, NULL, " %%u", val); +} +static void flower_print_key_id(const char *name, struct rtattr *attr) +{ if (!attr) return; - print_nl(); - sprintf(namefrm, " %s %%u", name); - print_uint(PRINT_ANY, name, namefrm, rta_getattr_be32(attr)); + flower_print_uint(name, rta_getattr_be32(attr)); } static void flower_print_geneve_opts(const char *name, struct rtattr *attr, @@ -2342,8 +2344,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 +2434,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 +2453,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); + flower_print_string(name, out); } static void flower_print_u8(const char *name, struct rtattr *attr) @@ -2463,14 +2463,10 @@ 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)); + flower_print_uint(name, rta_getattr_u32(attr)); } static void flower_print_mpls_opt_lse(struct rtattr *lse) From patchwork Sat Jan 8 20:46: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: 12707605 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 7A391C433FE for ; Sat, 8 Jan 2022 20:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232858AbiAHUrB (ORCPT ); Sat, 8 Jan 2022 15:47:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232837AbiAHUq6 (ORCPT ); Sat, 8 Jan 2022 15:46:58 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B99FC06173F for ; Sat, 8 Jan 2022 12:46:58 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id e19so1963915plc.10 for ; Sat, 08 Jan 2022 12:46: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=xTv36HrfT2tq5353RQdFWy6gDnAyVsc62fD0UKUaPu8=; b=BoC0HHUn+/pOlRxW+frAvIB5lYXHWs64d+a1wyOsrIV8jKqukqGKZ9x8kd5hVKi1Ay RVf7GH6l9FjUaNNLsXrl+atcJ+G695V/8Kroa5iK701DBg0UZs89cmjd4y3vy3wbSL9B vOfPtPHfpyaImU6nxhN9kY2vxoiBohxya4jXUZMNN+gPWZ90GVsaEwGTcEczooAse4At 2TP1u363lSMaoDrDCX8efYZUTnIpGY0dPdJEDR9ozXk2pc8XTrwnoUa4RD1Jgy1SfKZG WcBamR3bCUHwTyA1DjEE0WMA0X1hToVIDgixLEV2D2LvLhM6IVrWHdaFxDErUR87li05 149g== 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=xTv36HrfT2tq5353RQdFWy6gDnAyVsc62fD0UKUaPu8=; b=Pc5jBvszyeuFP73EkK85GD64wLQL7BKkMt3iZse9spWgQM5a3voYAYLVTq20Hq/kUf dudw2svY6B9lobgNeQNSTNg9HYyqC0De/dDekQvthXB+voVorONXQxEyHojlsKzpBdZN Z70WWntB2u0RE/uYBUtiXi1LSSt11HKtB4uLiE0obKCD0D4Shy7xM8MWVjf85n6an0KQ ECtczG6pbVxp3o6uh04a0ZqYx1PAE/L38EgwuzSZbJ3UsTCQF+roSqgab0eMtpbVzQlj XhSC4pSphSrwsTbVc7lj3vmIkZ1j2QgfuY6xS9QPb+7Ly76cvcnkxIud4cRd6YvuEr8E sEfQ== X-Gm-Message-State: AOAM531mStVaYcvk2d9IgLppusSxZDMTeOcrk4PpUT+cwMc495De8t4N nSlGB6CmN67UqY/eIHwe0M2aSNgqTDGz1w== X-Google-Smtp-Source: ABdhPJwBaOZILn1j5PtmDTvi+6paC3qIKQvYzqu9lUAOFnzDXaCT2uVnc6ef+zh1h1jEKygkEoKAmA== X-Received: by 2002:a17:90b:17cd:: with SMTP id me13mr22169861pjb.79.1641674817423; Sat, 08 Jan 2022 12:46:57 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u71sm2129393pgd.68.2022.01.08.12.46.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 12:46:57 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , idosch@nvidia.com Subject: [PATCH iproute2-next 06/11] nexthop: fix clang warning about timer check Date: Sat, 8 Jan 2022 12:46:45 -0800 Message-Id: <20220108204650.36185-7-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220108204650.36185-1-sthemmin@microsoft.com> References: <20220108204650.36185-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 correctly flags that ipnexthop is comparing timer with a value that it can never have. On 64 bit platform ~0UL / 100 = 184467440737095516 and timer is u32 so max is 4294967295. Fixes: 91676718228b ("nexthop: Add support for resilient nexthop groups") Cc: idosch@nvidia.com Signed-off-by: Stephen Hemminger --- ip/ipnexthop.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c index 83a5540e771c..2c65df294587 100644 --- a/ip/ipnexthop.c +++ b/ip/ipnexthop.c @@ -31,6 +31,8 @@ enum { IPNH_FLUSH, }; +#define TIMER_MAX (~(__u32)0 / 100) + #define RTM_NHA(h) ((struct rtattr *)(((char *)(h)) + \ NLMSG_ALIGN(sizeof(struct nhmsg)))) @@ -839,8 +841,8 @@ static void parse_nh_group_type_res(struct nlmsghdr *n, int maxlen, int *argcp, __u32 idle_timer; NEXT_ARG(); - if (get_unsigned(&idle_timer, *argv, 0) || - idle_timer >= ~0UL / 100) + if (get_u32(&idle_timer, *argv, 0) || + idle_timer >= TIMER_MAX) invarg("invalid idle timer value", *argv); addattr32(n, maxlen, NHA_RES_GROUP_IDLE_TIMER, @@ -849,8 +851,8 @@ static void parse_nh_group_type_res(struct nlmsghdr *n, int maxlen, int *argcp, __u32 unbalanced_timer; NEXT_ARG(); - if (get_unsigned(&unbalanced_timer, *argv, 0) || - unbalanced_timer >= ~0UL / 100) + if (get_u32(&unbalanced_timer, *argv, 0) || + unbalanced_timer >= TIMER_MAX) invarg("invalid unbalanced timer value", *argv); addattr32(n, maxlen, NHA_RES_GROUP_UNBALANCED_TIMER, From patchwork Sat Jan 8 20:46: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: 12707607 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 99E62C4332F for ; Sat, 8 Jan 2022 20:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232860AbiAHUrC (ORCPT ); Sat, 8 Jan 2022 15:47:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232845AbiAHUq7 (ORCPT ); Sat, 8 Jan 2022 15:46:59 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01B60C061401 for ; Sat, 8 Jan 2022 12:46:59 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id l10-20020a17090a384a00b001b22190e075so16979973pjf.3 for ; Sat, 08 Jan 2022 12:46: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=2C+2eEriNgfUMFK2tfl8QCL4ko+C8d9Iz4dkqd/S39I=; b=y/gCiyW8ZHIXMsIbefnUkbUIRfIIXRiu9UkcVQmEZq/fPhTK2xMwzotHViEBbapWg7 IrXKy3THpyZ96XgnfQ9AJMVqrQVqHGeI6LQgZmIKGeOW8v0DQ94EvcN4JmLEia8ymMxo 2qTDTzwDT5zzrMqfcWolaupiJ5nqqothZ6Y4W5KEWPcQAP3N9hJ0/OYkctC67DL8RKdY ROhl2iHi9eakEK1zbejh1+SUIvIqJF+OdAFpnxWbSxTo05qgOI4CrRTVaOHeQlE2g7av NSG6uNKlh5/5W7wbWfYg+8vuqM7yqQ1WiSkrC/nGXJmWhsS46f2WS0K9r+6MDS8eCcEK JZVA== 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=2C+2eEriNgfUMFK2tfl8QCL4ko+C8d9Iz4dkqd/S39I=; b=Mtamb0lP6Bb2HZh2Ftkam0Dmh8CwXrfA6eMfzVRMEFI0X7Zb72AdvkJDjqVPjabS6m Esvxf0cWnwkJdLnTv5Ou4ef4kgw9HHW1ELRxJsAnmEr3HzqOEtYfa4SVCOiV2rScgGYC alDdGNBZutVK8i33MWWd76qhTwD/YYr0lBbRkxW3L0ljlM1TpPEpkhqV5dju6yapQ7i0 2I3ryJ69bjtwDuVkIbSPTmx0vQFxALKjDdyNl2mrLhLRbHDnAtzsLXbN/uCEH0SRnzMJ WRoswiZgFGqlGPHShd7sbeO1Ux9UKxh7Ebo4dz3k/cmx27QQMrLFbmiEox/ENoaCyr2k tQMQ== X-Gm-Message-State: AOAM533Ey3fyCPkg1RX06Bzw+LSCZoYIYvKG+lX26Ao1yplCIIm5ja8W lX9ME06Zxr9rD5cHLkrBPwDawPD0Wm0x/g== X-Google-Smtp-Source: ABdhPJwWEIXXPyzahWT7lThJ27KVK8mTTSOmxNdB0ByAJdPkcG+FiLfFwQATqUYyHjQ/2CDYiGX29g== X-Received: by 2002:a05:6a00:2313:b0:4bb:8b68:3677 with SMTP id h19-20020a056a00231300b004bb8b683677mr69098381pfh.2.1641674818254; Sat, 08 Jan 2022 12:46:58 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u71sm2129393pgd.68.2022.01.08.12.46.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 12:46:57 -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 iproute2-next 07/11] tc_util: fix clang warning in print_masked_type Date: Sat, 8 Jan 2022 12:46:46 -0800 Message-Id: <20220108204650.36185-8-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220108204650.36185-1-sthemmin@microsoft.com> References: <20220108204650.36185-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 was doing extra work the JSON case. It 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 | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/tc/tc_util.c b/tc/tc_util.c index 6d5eb754831a..c95b6fd6e49d 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,21 @@ 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(PRINT_FP, NULL, " %s", name); + print_string(PRINT_FP, NULL, " %s", out); } } From patchwork Sat Jan 8 20:46: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: 12707608 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 BD8BAC43219 for ; Sat, 8 Jan 2022 20:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232874AbiAHUrD (ORCPT ); Sat, 8 Jan 2022 15:47:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229571AbiAHUq7 (ORCPT ); Sat, 8 Jan 2022 15:46:59 -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 BF0B4C061746 for ; Sat, 8 Jan 2022 12:46:59 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id n16so8687071plc.2 for ; Sat, 08 Jan 2022 12:46: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=2CmMkcLMupEBjGGLQZwEV/RJ8zBm1D0fwzw031sSOqU=; b=0rPYRnKNRhtlMYo+umF2B60X6BEycU3ZJgf0/ppnv67ilsdZAz6Ue6f1fciZHysZ+F +aqe7y80PCj7zqVsTCYjMoWo2k0EOFERwbQQqb0zfz2brgaPmE44KmxKk14N7ANGJZtG oIm3aq1n+rVLsdz7W2B32keycCV8Pqlne/LKs4TWWNMtSKeQSNCdTUiVW9IL0FeZwOLS qEJnpYkgtscL+BY6mYgiycuv2PN86t35V0+fWE0eKkE35RC5PVZtu/hU6m50NSlUoscF lOLNYEgt8xKZI2fUCun9MFomVVC1SPXBmhQ2pm0EK2aAThchswzcOn7q2pjPriae/qVE vRFw== 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=TbSb1kG+lLQUC13KMrwCcgUFgsQ79taeI+K0Nrnu0I6EvvPq6E5maCiC+C58zfcy7b OMq9NZ0pELNZM/BapAWhhdccxhSaDrR2PmsnRB+grhHjXqZHJeQttF/+JGAn/RZuTKLe /XaoPFR8tLA27xI6lBc7iAFImZrqv7ViHFegWrkbE6CYdTunqnHdHk0JGaEiu+jvjmyo qg4gp1zuVmT6EiDOSiH1qtdArKs0fW31Z8AU1HMEDKiRObo4yB2mvD9Qbh6J2Fqhsya3 VzdNuIDoWKAU1LFOra00tO6f4QcwZ6JeLNtxP39UysS0x287IFmwl2c6y/0U73EXBmSA Swug== X-Gm-Message-State: AOAM530yA1mAQdvdQ47ZwzXkdBsV4/XrytMY3dFWHNkrHktyWkmTZltM rs9B7mYnNwHYXY3CmlRBj3Ds73+AWn/9IQ== X-Google-Smtp-Source: ABdhPJybsjb8lYpmoxR7mNlp+CNZ+az4HuON5Xe1NNOpEPE3svNcxFGDLVWLO3SwzdxiVNt7bnjhvA== X-Received: by 2002:aa7:9705:0:b0:4bb:6897:6b80 with SMTP id a5-20020aa79705000000b004bb68976b80mr70449787pfg.21.1641674819025; Sat, 08 Jan 2022 12:46:59 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u71sm2129393pgd.68.2022.01.08.12.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 12:46:58 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , Stephen Hemminger Subject: [PATCH iproute2-next 08/11] ipl2tp: fix clang warning Date: Sat, 8 Jan 2022 12:46:47 -0800 Message-Id: <20220108204650.36185-9-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220108204650.36185-1-sthemmin@microsoft.com> References: <20220108204650.36185-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 Sat Jan 8 20:46: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: 12707606 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 A8D2BC43217 for ; Sat, 8 Jan 2022 20:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232866AbiAHUrC (ORCPT ); Sat, 8 Jan 2022 15:47:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232836AbiAHUrA (ORCPT ); Sat, 8 Jan 2022 15:47:00 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82F25C061747 for ; Sat, 8 Jan 2022 12:47:00 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id y16-20020a17090a6c9000b001b13ffaa625so17019231pjj.2 for ; Sat, 08 Jan 2022 12:47: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=/oE5+nHZ47hf0eq1B8VOPvwAM1+8jomIksNPwOnPNNA=; b=i11ZZY/jvBM9E7qTgrqPQruU15VuLtpSdJ5hq8q/Hj+OsjwHNCTUdGKRO7WLEuTdKA phZjJVdre07Pre94MQOKo5NMADOnLBJmlHKr/fDEbriizIXlRiulpXuD7GeZJvbzeP6v uXlwUeoGtdx2R+0RnYEw9CpwGmeBpmXytR/l+eCLDnGmmZrpm8gavTRlItaVm4au8fiC E8mrf0qgYajGZI0ITynWcAVIaZ2vss2hja/A++1LRCKCz/hoOdiE5rbRuZEvaoFHK9Op 6vbAQH6aI4m59oJ6kmJFppE5II2QExoATnEEefBvMQ9DZW16DUI7asFiE0Y7LY4XjD0E sjIw== 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=6IQEZjZ1XGdD9x7AUvGVnF6XmGLMp4zQtx7o3f+7XSYwc20D8G5ukRtyJZ4gyTXm5w D3c4CXtVge6uIp7cZwNmgU7zbmy3UehVmDqXu6VrPb1OOJj9oChknqpVMLVJ2G6DIHhS c4BOrOAoUDlZ1bEpF24mCG5OQsS+DRr2lUyBL/+lsJnlEaGTWNDEmAhve2K/jDWGj0ln k6nTELJyPw9zlmnQwgUIVI5uTOQJESF2FunRfsqlrBUuTgE/o1g7vibHHI4CAuEcE++s oJ+qP+DN1X/ACaBcwpfBr59+eVM9WOdIvPWXUp+/9LZ+HJTYLigtZbOac6XT+sNqeWc6 Klng== X-Gm-Message-State: AOAM533CQrSSLVrSg0MCTjX6tejYhJKXhDOrRakQIkY3NRoy/4RGMhrx 2oLDGtaP6sz2n9sGEs8I/RBCqh0UuEdAKQ== X-Google-Smtp-Source: ABdhPJxeGH+MSTcxG6DNMDcWG1+wJVy0wYmrNRUk10yMvwJgZS85MxEm0WEBbGdK5hdcowdobptZcQ== X-Received: by 2002:aa7:8c57:0:b0:4bc:1474:16f with SMTP id e23-20020aa78c57000000b004bc1474016fmr53211354pfd.37.1641674819784; Sat, 08 Jan 2022 12:46:59 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u71sm2129393pgd.68.2022.01.08.12.46.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 12:46:59 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , Stephen Hemminger Subject: [PATCH iproute2-next 09/11] can: fix clang warning Date: Sat, 8 Jan 2022 12:46:48 -0800 Message-Id: <20220108204650.36185-10-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220108204650.36185-1-sthemmin@microsoft.com> References: <20220108204650.36185-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 Sat Jan 8 20:46: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: 12707609 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 CC65FC4167B for ; Sat, 8 Jan 2022 20:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232836AbiAHUrF (ORCPT ); Sat, 8 Jan 2022 15:47:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232855AbiAHUrB (ORCPT ); Sat, 8 Jan 2022 15:47:01 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C7A1C06173F for ; Sat, 8 Jan 2022 12:47:01 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id rj2-20020a17090b3e8200b001b1944bad25so11350116pjb.5 for ; Sat, 08 Jan 2022 12:47: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=74kcV1kq3XqBCswjyh0NmJxjkLOaCkow0LnYZQJp7Ng=; b=aOmJyD2h62/vzqTFTZ9dSI81mhPGV87FukXYQ0Qhzlv4P+TbUnZQBDbXyJUxPw5hiq 1GBXjojr+FaOaJ89zvgmQsNptzMm/JvwFvANCld2U5MiluYbgt95PTcKo8SqI1i3jYBD KBOHOqnOVQoKtGOzdwHvZV++4Z8LTILrP470qbq/m4L5eLAhSIkJD+i4rEqrsTczU97I X/60YXDlgqPhACcTYJfKz4hlSd68aU+1qumjDzI+xa53t+Py3ZUF/YgyC+D7paxALJAJ sfNhFohuI8bUCOHz6EfHAKy/J7JHA50ASsSiQ+NlYUjuWxkDG+/rNWL2+3cF3v9GjCjA hb1g== 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=hr3BsCyIFe6ilOOvk7GvOSi1CiKRIEPuyomcyk+P2jzoj47iHiJtRPFGaQbVlYvdy9 fLVyPe85dgcJRoh67AQnbqTasixEVApo5XLjTk2MjwEFZ/wXkar3VGjPqbx5EW3NCYPT 3xTJBK771c4E4BerfV0QFFxnY2xZLDO4HERxs0M1UF5iKqFhDVl9394TskAHRUaw8CLE gr4PrIPVIask7xvoAWgwxhHsXkzNYRFIOMNiDwyVREJfhrE2X2Ckp14HPMAR7KB2CFfG O7npMeQoj8XOmSljWswB/MVpnGjF4z8N1RAHKRZKqKrm1feF6j47S6FxU3k+Q9sm7A5D 8ahA== X-Gm-Message-State: AOAM532KyTKhwjFpzWYyJL42EmrgxUE0bkTqqSAAiE2HTk46oXt8g9DD NwsZH0aqhxdxh1sunPowaq5OSeWLCmLioQ== X-Google-Smtp-Source: ABdhPJytdgbyUTyzPcq/1+ye3UML6a0vhHIfPz/6F+heaQBpdhMqlLH3vynWOxI028o1P9LMA4tm1A== X-Received: by 2002:a05:6a00:ad1:b0:4bb:b74b:a494 with SMTP id c17-20020a056a000ad100b004bbb74ba494mr63238385pfl.28.1641674820775; Sat, 08 Jan 2022 12:47:00 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u71sm2129393pgd.68.2022.01.08.12.46.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 12:47:00 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , Stephen Hemminger Subject: [PATCH iproute2-next 10/11] tipc: fix clang warning about empty format string Date: Sat, 8 Jan 2022 12:46:49 -0800 Message-Id: <20220108204650.36185-11-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220108204650.36185-1-sthemmin@microsoft.com> References: <20220108204650.36185-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 Sat Jan 8 20:46: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: 12707611 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 DB775C4321E for ; Sat, 8 Jan 2022 20:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232851AbiAHUrG (ORCPT ); Sat, 8 Jan 2022 15:47:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232861AbiAHUrC (ORCPT ); Sat, 8 Jan 2022 15:47:02 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54F30C061401 for ; Sat, 8 Jan 2022 12:47:02 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id ie23-20020a17090b401700b001b38a5318easo2274275pjb.2 for ; Sat, 08 Jan 2022 12:47: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=FPipWv3MHN1kYGMaxOweRrJO5QJl/5UqDMCci+/rpOw=; b=V703eSsNA1GnWu0LNnGyWPzH/mmL77kx4Pk2nD2SwWRZQCai66QInPPP/kcq4EtmLT XkXi6v7CYJ9Y8ZtWLcrAn/Ho6xC46/Ea0aze2B/JKGYEDqg3uxetrI1wD5DYKB4BYAdF Zk3ElKjmwt5ExdQpXblSDsd5GK9vGqS5DMdUr2ma0NwRg26WcVDGkcXcXY5xd60HV3JS rS4TfFf1LpDGlKY7OdsRFU9eKu/5l1KN6RjVy8In8KD+se11arPuLL/igX1yDKUjdje1 VEi1gY8oe2vYOUbDTZiNVP6Ivk/4VDdBeS6Evker6XCObcVr9+HeO62+OE3Iim3D6bYS RC4g== 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=FPipWv3MHN1kYGMaxOweRrJO5QJl/5UqDMCci+/rpOw=; b=g1C5CqjhQBtvef1Y0U29mVbUYEMkGYquOu7KPdOmE0w7PNQkDgrwDWfsYXcWVcUg2q 61ESp0slGnoi71b+0n179KWypodbS8+YrLaBzBa5twrC3JaI1Ry1070fxEsySvuhDWPe N/+CLg4EwvhqKChQZIYk5osxRabbzHVd2iTHsllaKlR3fIixN9ZOgSX/otCPsPC15+Ae c0RyOmVoQrVcxkOlwfKH6Se4EycvxiMAlTsVQW35VWwpMyzPFSaPpCNuwKwSjN4GX040 aHZdNqEQM+Esv7kq5OpSviWALw/moGoQDRjVSObzc1plhrxxLpUKUXXPrW+9I4C0j79e sGfQ== X-Gm-Message-State: AOAM532A/egqOotk5FdA0ut++MBgdU095ijEGLRyj5PWOvZvyZo+3osz xpsQHK+F4pNHIVadxh41BtM28asKG8HJYw== X-Google-Smtp-Source: ABdhPJwtKBsMEbDPZ8cyRjLp0NDV3NRbdmUlZRojdVGhnChmyecYoeKp1qlcz3GiSu3Fs7yIxorp+A== X-Received: by 2002:a17:90b:3b8e:: with SMTP id pc14mr22382069pjb.217.1641674821628; Sat, 08 Jan 2022 12:47:01 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u71sm2129393pgd.68.2022.01.08.12.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 12:47:01 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger , Stephen Hemminger Subject: [PATCH iproute2-next 11/11] tunnel: fix clang warning Date: Sat, 8 Jan 2022 12:46:50 -0800 Message-Id: <20220108204650.36185-12-sthemmin@microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220108204650.36185-1-sthemmin@microsoft.com> References: <20220108204650.36185-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 split the print into two calls. Signed-off-by: Stephen Hemminger --- ip/tunnel.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ip/tunnel.c b/ip/tunnel.c index 88585cf3177b..9d1a745d9d2d 100644 --- a/ip/tunnel.c +++ b/ip/tunnel.c @@ -301,10 +301,8 @@ void tnl_print_endpoint(const char *name, const struct rtattr *rta, int family) 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(PRINT_FP, NULL, "%s ", name); + print_string(PRINT_FP, NULL, "%s ",value); } }