From patchwork Mon Oct 31 11:44:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13230 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2262243wru; Mon, 31 Oct 2022 04:46:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fdXQvVB8BfF/EgZvxyyL6r/CYaAr5shxwaCiwSdhxW/aZoEMvzkcUyTM+bC5uNvAdW6KN X-Received: by 2002:a17:907:6e28:b0:7a0:b6b5:5103 with SMTP id sd40-20020a1709076e2800b007a0b6b55103mr12264199ejc.300.1667216780987; Mon, 31 Oct 2022 04:46:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667216780; cv=none; d=google.com; s=arc-20160816; b=ySIuoR6Y/o7c1R3wEcEe4KNWNT69DTLj5I78aOZHfBNthqFg8iMQs7y7LF9r7oCXs8 8TOiXwC5j1/GRyfME9cmcE8e1DSaMonCCAs27lVKJ4MQJb0vfSMbjqBI1Jg+4xxwavut HhQT1mfSmrqPPSF95W0pbrekm6UjC0heV7hW/P4ncCEOSJVZnEOtHLf9XcsN5vFqzdwD hQkBHYhXHKCHAfTx/BMXNL6xBCIDLykVqJIox/iQv028ERe0TYfwabrnbJkN/AWk9vVw sVCq6IQR0aWRe28CZgtd/2Lw7JXfYgqF34SBRWnYGOrTLskBLeOSSciTcy6HjlHiHYZK 63Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=tapGz3YUolrPp20I1xzM7AGYFz098WP2wkFVPoZcmoE=; b=WxJehNEPE6r1Y4Sn1JiLRHBG8ga3VdFAot9IIdkNYLBnKc7//9+9nBaTJ5x8aMw7h8 0qYWSFBlAa5kuz25natbCafkgSGtvzXC2hKAmgyo676MeSqHwd80XRcfiJ4Xyo0tWpH0 jgFdGalT9gJvg55XHTRkhZLkxYi68PJ7qaIm6zsnkOP/6BNRNybWSEh4iT1JgCtKNCcw 0WfJ0JaQEqU6xGEiCSY7cg81jmYH6ibKx9oZee2a4lecQa+1IZkKprI5hPD2BncgaEDR 4tIb1IAxy3Iumleas1CDptZVwocLHcnMQdGS7qrir4dkgJPEyI0E5MidKvWI4pCC2is1 USWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XHOKN6Ei; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ss28-20020a170907c01c00b007707b853e46si5787402ejc.882.2022.10.31.04.45.55; Mon, 31 Oct 2022 04:46:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XHOKN6Ei; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230520AbiJaLow (ORCPT + 99 others); Mon, 31 Oct 2022 07:44:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231137AbiJaLof (ORCPT ); Mon, 31 Oct 2022 07:44:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BEB6F02C; Mon, 31 Oct 2022 04:44:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 03E6CB815F0; Mon, 31 Oct 2022 11:44:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7877CC433D6; Mon, 31 Oct 2022 11:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667216668; bh=nToB1GC3IZYvNqBjpUGx00XoAWJDS1KYM7LwXh0TTXQ=; h=From:To:Cc:Subject:Date:From; b=XHOKN6EiXg24tI+YL5fNUQoIwWC8ToQ9v5XYBhYzBFQ5dXVhDq7TedJ+jpHoKInF1 hu+XjGGHhJqDa7DBprj1D+AkyhtMrccFKhSLEQdt9WHlOb5NlNvYD+bJzuIGFeJmDC TBiuEha58nxC2+9v3RmYIlzY84i7N1IHV0XVw/NvUTS3+9pDpTFtDmoKokY5bDBGIi ANsVKljgQMZPEniEIw+BzBkMhWbUb824VrBHjga5LWskEW22rK+TZaZ++cCDkTfyPg wxGMYx2Dld/7znmv+uTqrbYdIsIGQvjmzyMSvVwPeRjEER0GFJ1eBb9Du7blIB5PhG fEChIgrGSLo0Q== From: "Jiri Slaby (SUSE)" To: Jason@zx2c4.com Cc: linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Martin Liska , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , wireguard@lists.zx2c4.com, netdev@vger.kernel.org Subject: [PATCH] wireguard (gcc13): cast enum limits members to int in prints Date: Mon, 31 Oct 2022 12:44:24 +0100 Message-Id: <20221031114424.10438-1-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748203503397346196?= X-GMAIL-MSGID: =?utf-8?q?1748203503397346196?= Since gcc13, each member of an enum has the same type as the enum [1]. And that is inherited from its members. Provided "REKEY_AFTER_MESSAGES = 1ULL << 60", the named type is unsigned long. This generates warnings with gcc-13: error: format '%d' expects argument of type 'int', but argument 6 has type 'long unsigned int' Cast the enum members to int when printing them. Alternatively, we can cast it to ulong (to silence gcc < 12) and use %lu. Alternatively, we can move REKEY_AFTER_MESSAGES away from the enum. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36113 Cc: Martin Liska Cc: "Jason A. Donenfeld" Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: wireguard@lists.zx2c4.com Cc: netdev@vger.kernel.org Signed-off-by: Jiri Slaby (SUSE) --- drivers/net/wireguard/timers.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireguard/timers.c b/drivers/net/wireguard/timers.c index b5706b6718b1..51081ba93609 100644 --- a/drivers/net/wireguard/timers.c +++ b/drivers/net/wireguard/timers.c @@ -46,7 +46,7 @@ static void wg_expired_retransmit_handshake(struct timer_list *timer) if (peer->timer_handshake_attempts > MAX_TIMER_HANDSHAKES) { pr_debug("%s: Handshake for peer %llu (%pISpfsc) did not complete after %d attempts, giving up\n", peer->device->dev->name, peer->internal_id, - &peer->endpoint.addr, MAX_TIMER_HANDSHAKES + 2); + &peer->endpoint.addr, (int)MAX_TIMER_HANDSHAKES + 2); del_timer(&peer->timer_send_keepalive); /* We drop all packets without a keypair and don't try again, @@ -64,7 +64,7 @@ static void wg_expired_retransmit_handshake(struct timer_list *timer) ++peer->timer_handshake_attempts; pr_debug("%s: Handshake for peer %llu (%pISpfsc) did not complete after %d seconds, retrying (try %d)\n", peer->device->dev->name, peer->internal_id, - &peer->endpoint.addr, REKEY_TIMEOUT, + &peer->endpoint.addr, (int)REKEY_TIMEOUT, peer->timer_handshake_attempts + 1); /* We clear the endpoint address src address, in case this is @@ -94,7 +94,8 @@ static void wg_expired_new_handshake(struct timer_list *timer) pr_debug("%s: Retrying handshake with peer %llu (%pISpfsc) because we stopped hearing back after %d seconds\n", peer->device->dev->name, peer->internal_id, - &peer->endpoint.addr, KEEPALIVE_TIMEOUT + REKEY_TIMEOUT); + &peer->endpoint.addr, + (int)(KEEPALIVE_TIMEOUT + REKEY_TIMEOUT)); /* We clear the endpoint address src address, in case this is the cause * of trouble. */ @@ -126,7 +127,7 @@ static void wg_queued_expired_zero_key_material(struct work_struct *work) pr_debug("%s: Zeroing out all keys for peer %llu (%pISpfsc), since we haven't received a new one in %d seconds\n", peer->device->dev->name, peer->internal_id, - &peer->endpoint.addr, REJECT_AFTER_TIME * 3); + &peer->endpoint.addr, (int)REJECT_AFTER_TIME * 3); wg_noise_handshake_clear(&peer->handshake); wg_noise_keypairs_clear(&peer->keypairs); wg_peer_put(peer);