Re: [GIT PULL] usercopy structs for v5.4-rc2

From: Al Viro
Date: Thu Oct 10 2019 - 11:15:11 EST


On Mon, Oct 07, 2019 at 01:11:46PM +0000, David Laight wrote:
> From: Nathan Chancellor
> > Sent: 04 October 2019 20:44
> ...
> > > IOW, the code should have just been
> > >
> > > ret = test(umem_src == NULL, "kmalloc failed");
> > > if (ret) ...
> >
> > Yes, I had this as the original fix but I tried to keep the same
> > intention as the original author. I should have gone with my gut. Sorry
> > for the ugliness, I'll try to be better in the future.
>
> This rather begs the question about why 'usercopy' is ever calling kmalloc() at all.

Do you even bother to read what you are commenting upon, or is it simply the
irresistable pleasure of being seen[*]?

When a function called 'test_copy_struct_from_user' starts with a couple of
allocations, one called 'umem_src' and another - 'expected', what could that
possibly be about? Something to do with testing copy_struct_from_user(),
perhaps? And, taking a wild guess, maybe allocating a buffer or two to
be somehow used in setting the test up?

Or you could just go and read the damn function, you twit.

[*] sensu Monty Python, if we are lucky enough