[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200406121032.GX21484@bombadil.infradead.org>
Date: Mon, 6 Apr 2020 05:10:32 -0700
From: Matthew Wilcox <willy@...radead.org>
To: Christoph Hellwig <hch@....de>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Jeremy Kerr <jk@...abs.org>, Arnd Bergmann <arnd@...db.de>,
linuxppc-dev@...ts.ozlabs.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/6] exec: open code copy_string_kernel
On Mon, Apr 06, 2020 at 02:03:12PM +0200, Christoph Hellwig wrote:
> + int len = strnlen(arg, MAX_ARG_STRLEN) + 1 /* terminating null */;
If you end up doing another version of this, it's a terminating NUL, not null.
I almost wonder if we shouldn't have
#define TERMINATING_NUL 1
in kernel.h.
int len = strnlen(arg, MAX_ARG_STRLEN) + TERMINATING_NUL;
has a certain appeal. There's the risk people might misuse it though ...
str[end] = TERMINATING_NUL;
so probably not a good idea.
Powered by blists - more mailing lists