[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFxvk-CqFYjpQp-c7PdJyk-iXaZMQe0-fZqo+33dEXZe-g@mail.gmail.com>
Date: Sat, 17 Dec 2016 19:34:45 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
"Darrick J. Wong" <darrick.wong@...cle.com>
Subject: Re: [git pull] vfs.git pile 2
On Sat, Dec 17, 2016 at 7:26 PM, Al Viro <viro@...iv.linux.org.uk> wrote:
>
> One, AFAICS - pointless *len = 0 in case of is_dedupe.
Yup.
That part made sense in the original code where len and ret were
different. Now it just looks like a five-year old has been eating
crayons and paste.
> What else am I missing there?
I absolutely *abhor* this part:
*len = isize - pos_in;
because the whole code then depends on the overflow checking a few
lines down, and it's not at all obvious. We have not tested that
"pos_in" is smaller than "isize", even though the comment above the
"isize == 0" test inplies we did some kind of "past the end check" (we
did not).
The whole "depend on overflow checking" being nasty is particularly
true when that checking itself is damn subtle, and depends deeply on
the type of "*len" being unsigned and larger than "loff_t". Which in
turn is true, but it's all really nasty, and it's subtle. "loff_t" is
"long long", while "*len" is u64, and it's almost just luck that the
comparison does in fact end up unsigned.
So I think that code really needs a fair amount of loving.
Linus
Powered by blists - more mailing lists