[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YgWQbpBX6eJNozGM@antec>
Date: Fri, 11 Feb 2022 07:23:42 +0900
From: Stafford Horne <shorne@...il.com>
To: David Laight <David.Laight@...lab.com>
Cc: 'Arnd Bergmann' <arnd@...nel.org>, Michal Simek <monstr@...str.eu>,
Christoph Hellwig <hch@...radead.org>,
Arnd Bergmann <arnd@...db.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] microblaze: remove CONFIG_SET_FS
On Thu, Feb 10, 2022 at 02:21:07PM +0000, David Laight wrote:
> From: Arnd Bergmann
> > static inline int __range_ok(unsigned long addr, unsigned long size)
> > {
> > return size <= TASK_SIZE && addr <= (TASK_SIZE - size);
> > }
> >
> > since 'size' is usually constant, so this turns into a single comparison
> > against a compile-time constant.
>
> Hmmm... maybe there should be a comment that it is the same as
> the more obvious:
> (addr <= TASK_SIZE && addr <= TASK_SIZE - size)
> but is better for constant size.
> (Provided TASK_SIZE is a constant.)
Ah, this makes sense that. I might as well revert the OpenRISC patch for this.
Though, we shall move to the generic version in the end.
With ideal compare:
-rwxrwxr-x. 1 shorne shorne 6011932 Feb 9 17:57 vmlinux
With comparing (size <= TASK_SIZE && addr <= TASK_SIZE - size):
-rwxrwxr-x. 1 shorne shorne 6003556 Feb 11 07:18 vmlinux
-Stafford
Powered by blists - more mailing lists