All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	davem@davemloft.net, Greg KH <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v2 17/17] net: WireGuard secure network tunnel
Date: Sat, 25 Aug 2018 01:00:45 +0200	[thread overview]
Message-ID: <20180824230045.GH27483@lunn.ch> (raw)
In-Reply-To: <20180824213849.23647-18-Jason@zx2c4.com>

Hi Jason

It is normal to include after the --- what you have changed since the
previous version.

I ran checkpatch on this again.

Last time, we had:

total: 6 errors, 763 warnings, 6514 lines checked

This time, we have:

total: 8 errors, 196 warnings, 7470 lines checked

So much better with the warnings. Thanks.

The errors should be simple to fix:

ERROR: that open brace { should be on the previous line
ERROR: that open brace { should be on the previous line
ERROR: spaces required around that '=' (ctx:VxW)
ERROR: spaces required around that '=' (ctx:VxW)
ERROR: spaces required around that '=' (ctx:VxW)
ERROR: that open brace { should be on the previous line
ERROR: Use of __initconst requires a separate use of const
ERROR: trailing whitespace

One appears to be a false positive:

+static const struct {
+       bool result;
+       unsigned int msec_to_sleep_before;
+} expected_results[] __initconst = {
+       [0 ... PACKETS_BURSTABLE - 1] = { true, 0 },
+       [PACKETS_BURSTABLE] = { false, 0 },
+       [PACKETS_BURSTABLE + 1] = { true, MSEC_PER_SEC / PACKETS_PER_SECOND },
+       [PACKETS_BURSTABLE + 2] = { false, 0 },
+       [PACKETS_BURSTABLE + 3] = { true, (MSEC_PER_SEC / PACKETS_PER_SECOND) * 2 },
+       [PACKETS_BURSTABLE + 4] = { true, 0 },
+       [PACKETS_BURSTABLE + 5] = { false, 0 }
+};

Looking at some of the warnings:

WARNING: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON()
#428: FILE: drivers/net/wireguard/allowedips.c:112:
+               BUG_ON(len >= 128); 

WARNING: Macros with flow control statements should be avoided
#5905: FILE: drivers/net/wireguard/selftest/ratelimiter.h:87:
+#define ensure_time do {                                                   \
+               if (time_is_before_jiffies(loop_start_time +               \
+                                          maximum_jiffies_at_index(i))) { \
+                       if (++tries >= 5000)                               \
+                               goto err;                                  \
+                       gc_entries(NULL);                                  \
+                       rcu_barrier();                                     \
+                       msleep(500);                                       \
+                       goto restart;                                      \
+               }                                                          \
+       } while (0)

WARNING: Macros with flow control statements should be avoided
#6948: FILE: drivers/net/wireguard/timers.c:29:
+#define peer_get_from_timer(timer_name)                                        \
+       struct wireguard_peer *peer;                                           \
+       rcu_read_lock_bh();                                                    \
+       peer = peer_get_maybe_zero(from_timer(peer, timer, timer_name));       \
+       rcu_read_unlock_bh();                                                  \
+       if (unlikely(!peer))                                                   \
+               return;

are not very nice.

WARNING: Possible unnecessary 'out of memory' message
#5306: FILE: drivers/net/wireguard/selftest/allowedips.h:261:
+       if (!peers) {
+               pr_info("allowedips random self-test: out of memory\n");

kcalloc and friends are pretty noisy when they fails. No need to add
your own print.

I see we still have a lot of __always_inline in C files :-(

	Andrew

  reply	other threads:[~2018-08-24 23:00 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24 21:38 [PATCH v2 00/17] WireGuard: Secure Network Tunnel Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 01/17] asm: simd context helper API Jason A. Donenfeld
2018-08-26 12:10   ` Thomas Gleixner
2018-08-26 13:45     ` Jason A. Donenfeld
2018-08-26 14:06       ` Thomas Gleixner
2018-08-26 14:18         ` Jason A. Donenfeld
2018-08-26 14:25           ` Andy Lutomirski
2018-08-26 14:18         ` Andy Lutomirski
2018-08-26 16:53           ` Rik van Riel
2018-09-01 20:19         ` Jason A. Donenfeld
2018-09-01 20:32           ` Andy Lutomirski
2018-09-01 20:34             ` Jason A. Donenfeld
2018-09-06 13:42               ` Thomas Gleixner
2018-09-06 15:52                 ` Jason A. Donenfeld
2018-08-27 19:50   ` Palmer Dabbelt
2018-08-27 19:50     ` Palmer Dabbelt
2018-08-24 21:38 ` [PATCH v2 02/17] zinc: introduce minimal cryptography library Jason A. Donenfeld
2018-08-25  6:29   ` Eric Biggers
2018-08-25 16:16     ` Andrew Lunn
2018-08-25 16:40     ` Jason A. Donenfeld
2018-08-25 17:26       ` Andrew Lunn
2018-08-26 15:59     ` Jason A. Donenfeld
2018-08-25 10:17   ` Ard Biesheuvel
2018-08-25 17:06     ` Jason A. Donenfeld
2018-08-25 17:17       ` Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 03/17] zinc: ChaCha20 generic C implementation Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 04/17] zinc: ChaCha20 ARM and ARM64 implementations Jason A. Donenfeld
2018-08-24 21:38   ` Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 05/17] zinc: ChaCha20 x86_64 implementation Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 06/17] zinc: ChaCha20 MIPS32r2 implementation Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 07/17] zinc: Poly1305 generic C implementation and selftest Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 08/17] zinc: Poly1305 ARM and ARM64 implementations Jason A. Donenfeld
2018-08-24 21:38   ` Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 09/17] zinc: Poly1305 x86_64 implementation Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 10/17] zinc: Poly1305 MIPS32r2 and MIPS64 implementations Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 11/17] zinc: ChaCha20Poly1305 construction and selftest Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 12/17] zinc: BLAKE2s generic C implementation " Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 13/17] zinc: BLAKE2s x86_64 implementation Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 14/17] zinc: Curve25519 generic C implementations and selftest Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 15/17] zinc: Curve25519 ARM implementation Jason A. Donenfeld
2018-08-24 21:38   ` Jason A. Donenfeld
2018-08-26 13:18   ` Ard Biesheuvel
2018-08-26 13:18     ` Ard Biesheuvel
2018-08-26 13:18     ` Ard Biesheuvel
2018-08-29  5:06     ` Jason A. Donenfeld
2018-08-29  5:06       ` Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 16/17] zinc: Curve25519 x86_64 implementation Jason A. Donenfeld
2018-08-24 21:38 ` [PATCH v2 17/17] net: WireGuard secure network tunnel Jason A. Donenfeld
2018-08-24 23:00   ` Andrew Lunn [this message]
2018-08-27 11:13   ` kbuild test robot
2018-08-27 12:52   ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180824230045.GH27483@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Jason@zx2c4.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.