hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/sound/core/control_compat.c
....@@ -1,21 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * compat ioctls for control API
34 *
45 * Copyright (c) by Takashi Iwai <tiwai@suse.de>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
196 */
207
218 /* this file included from control.c */
....@@ -35,24 +22,22 @@
3522 static int snd_ctl_elem_list_compat(struct snd_card *card,
3623 struct snd_ctl_elem_list32 __user *data32)
3724 {
38
- struct snd_ctl_elem_list __user *data;
25
+ struct snd_ctl_elem_list data = {};
3926 compat_caddr_t ptr;
4027 int err;
4128
42
- data = compat_alloc_user_space(sizeof(*data));
43
-
4429 /* offset, space, used, count */
45
- if (copy_in_user(data, data32, 4 * sizeof(u32)))
30
+ if (copy_from_user(&data, data32, 4 * sizeof(u32)))
4631 return -EFAULT;
4732 /* pids */
48
- if (get_user(ptr, &data32->pids) ||
49
- put_user(compat_ptr(ptr), &data->pids))
33
+ if (get_user(ptr, &data32->pids))
5034 return -EFAULT;
51
- err = snd_ctl_elem_list(card, data);
35
+ data.pids = compat_ptr(ptr);
36
+ err = snd_ctl_elem_list(card, &data);
5237 if (err < 0)
5338 return err;
5439 /* copy the result */
55
- if (copy_in_user(data32, data, 4 * sizeof(u32)))
40
+ if (copy_to_user(data32, &data, 4 * sizeof(u32)))
5641 return -EFAULT;
5742 return 0;
5843 }
....@@ -236,7 +221,7 @@
236221 {
237222 struct snd_ctl_elem_value32 __user *data32 = userdata;
238223 int i, type, size;
239
- int uninitialized_var(count);
224
+ int count;
240225 unsigned int indirect;
241226
242227 if (copy_from_user(&data->id, &data32->id, sizeof(data->id)))