bpf: use copy_struct_from_user() in bpf() syscall

In v5.4-rc2 we added a new helper (cf. [1]) copy_struct_from_user().
This helper is intended for all codepaths that copy structs from
userspace that are versioned by size. The bpf() syscall does exactly
what copy_struct_from_user() is doing.
Note that copy_struct_from_user() is calling min() already. So
technically, the min_t() call could go. But the size is used further
below so leave it.

[1]: f5a1a536fa14 ("lib: introduce copy_struct_from_user() helper")
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Aleksa Sarai <cyphar@cyphar.com>
Cc: bpf@vger.kernel.org
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
/* v1 */
Link: https://lore.kernel.org/r/20191009160907.10981-4-christian.brauner@ubuntu.com

/* v2 */
Link: https://lore.kernel.org/r/20191016004138.24845-4-christian.brauner@ubuntu.com
- Alexei Starovoitov <ast@kernel.org>:
  - remove unneeded initialization

/* v3 */
Link: https://lore.kernel.org/r/20191016034432.4418-4-christian.brauner@ubuntu.com

/* v4 */
- Alexei Starovoitov <ast@kernel.org>:
  - move misplaced min after copy_struct_from_user()
1 file changed