WireGuard Archive on lore.kernel.org
 help / color / Atom feed
From: Julian Orth <ju.orth@gmail.com>
To: Aaron Jones <aaronmdjones@gmail.com>
Cc: WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: [PATCH 6/7] tools: allow setting of transit net
Date: Sat, 8 Sep 2018 16:18:18 +0200
Message-ID: <ae953bd6-eb42-647b-1b1a-8de8e0e0bb15@gmail.com> (raw)
In-Reply-To: <58f22c10-24ba-91a7-2d7e-2d9fc3b50565@gmail.com>

On 9/8/18 4:09 PM, Aaron Jones wrote:
> On 08/09/18 12:18, Julian Orth wrote:
>> +static bool parse_transit_net(struct wgdevice *device, const char *arg)
>> +{
>> +	/* U32 arg -> PID */
>> +	if (isdigit(*arg)) {
>> +		char *end;
>> +		unsigned long pid = strtoul(arg, &end, 10);
>> +		if (!*end && pid <= UINT32_MAX) {
> 
> This condition will always be true on a 32-bit system (for a valid
> integer). I'd prefer strtoull() and `unsigned long long' but given
> that a valid file descriptor won't ever go that high... eh. shrug. But
> you'll still get a compiler diagnostic for it.

Even with clang's -Weverything I don't get a warning when I compile the 
following:

#include <stdint.h>

int f(unsigned int i);

int f(unsigned int i)
{
	return i <= UINT32_MAX;
}

I don't see why it would be different for unsigned long on a 32-bit system.

  reply index

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-08 12:18 [PATCH 0/7] Allow changing the transit namespace Julian Orth
2018-09-08 12:18 ` [PATCH 1/7] device: protect socket_init with device_update_lock Julian Orth
2018-09-08 12:18 ` [PATCH 2/7] device: rename creating_net to transit_net Julian Orth
2018-09-08 12:18 ` [PATCH 3/7] device: store a copy of the device net Julian Orth
2018-09-08 12:18 ` [PATCH 4/7] socket: allow modification of transit_net Julian Orth
2018-09-08 12:18 ` [PATCH 5/7] netlink: allow setting of transit net Julian Orth
2018-09-08 14:03   ` Aaron Jones
2018-09-08 14:20     ` Julian Orth
2018-09-08 14:28       ` Aaron Jones
2018-09-08 12:18 ` [PATCH 6/7] tools: " Julian Orth
2018-09-08 14:04   ` Aaron Jones
2018-09-08 14:09   ` Aaron Jones
2018-09-08 14:18     ` Julian Orth [this message]
2018-09-08 14:25       ` Aaron Jones
2018-09-08 12:18 ` [PATCH 7/7] tests: add test for transit-net Julian Orth
2018-09-08 13:39 ` [PATCH 0/7] Allow changing the transit namespace Bruno Wolff III
2018-09-08 13:49   ` Julian Orth

Reply instructions:

You may reply publically 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=ae953bd6-eb42-647b-1b1a-8de8e0e0bb15@gmail.com \
    --to=ju.orth@gmail.com \
    --cc=aaronmdjones@gmail.com \
    --cc=wireguard@lists.zx2c4.com \
    /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

WireGuard Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/wireguard/0 wireguard/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 wireguard wireguard/ https://lore.kernel.org/wireguard \
		wireguard@lists.zx2c4.com zx2c4-wireguard@archiver.kernel.org
	public-inbox-index wireguard


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/com.zx2c4.lists.wireguard


AGPL code for this site: git clone https://public-inbox.org/ public-inbox