[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230414154631.GK3390869@ZenIV>
Date: Fri, 14 Apr 2023 16:46:31 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Luca Vizzarro <Luca.Vizzarro@....com>
Cc: linux-kernel@...r.kernel.org,
Christian Brauner <brauner@...nel.org>,
Jeff Layton <jlayton@...nel.org>,
Chuck Lever <chuck.lever@...cle.com>,
Kevin Brodsky <Kevin.Brodsky@....com>,
Vincenzo Frascino <Vincenzo.Frascino@....com>,
Szabolcs Nagy <Szabolcs.Nagy@....com>,
Theodore Ts'o <tytso@....edu>,
David Laight <David.Laight@...lab.com>,
Mark Rutland <Mark.Rutland@....com>,
linux-fsdevel@...r.kernel.org, linux-morello@...lists.linaro.org
Subject: Re: [PATCH v2 1/5] fcntl: Cast commands with int args explicitly
On Fri, Apr 14, 2023 at 04:24:55PM +0100, Luca Vizzarro wrote:
> void __user *argp = (void __user *)arg;
> + int argi = (int)arg;
Strictly speaking, conversion from unsigned long to int is
an undefined behaviour, unless the value fits into the
range representable by int ;-)
> case F_SETFD:
> err = 0;
> - set_close_on_exec(fd, arg & FD_CLOEXEC);
> + set_close_on_exec(fd, argi & FD_CLOEXEC);
Why?
> case F_SETSIG:
> /* arg == 0 restores default behaviour. */
> - if (!valid_signal(arg)) {
> + if (!valid_signal(argi)) {
Why???
> break;
> }
> err = 0;
> - filp->f_owner.signum = arg;
> + filp->f_owner.signum = argi;
> break;
These two are clearly bogus and I'd like to see more details
on the series rationale, please.
Powered by blists - more mailing lists