sound/core/rawmidi_compat.c:29:29: warning: taking address of packed member 'mode' of class or structure 'snd_rawmidi_params32' may result in an unaligned pointer value
From: kernel test robot
Date: Thu Nov 25 2021 - 19:19:06 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8ced7ca3570333998ad2088d5a6275701970e28e
commit: 08fdced60ca08e34e316a3ab945636fcdfcbc973 ALSA: rawmidi: Add framing mode
date: 6 months ago
config: mips-randconfig-r002-20211031 (https://download.01.org/0day-ci/archive/20211126/202111260812.IlTs6tBq-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d321548c3ce987f4f21350ba1c81fdb5d4354224)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=08fdced60ca08e34e316a3ab945636fcdfcbc973
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 08fdced60ca08e34e316a3ab945636fcdfcbc973
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
In file included from sound/core/rawmidi.c:1608:
sound/core/rawmidi_compat.c:26:31: warning: taking address of packed member 'stream' of class or structure 'snd_rawmidi_params32' may result in an unaligned pointer value [-Waddress-of-packed-member]
if (get_user(params.stream, &src->stream) ||
^~~~~~~~~~~
arch/mips/include/asm/uaccess.h:135:21: note: expanded from macro 'get_user'
const __typeof__(*(ptr)) __user *__p = (ptr); \
^~~
In file included from sound/core/rawmidi.c:1608:
sound/core/rawmidi_compat.c:26:31: warning: taking address of packed member 'stream' of class or structure 'snd_rawmidi_params32' may result in an unaligned pointer value [-Waddress-of-packed-member]
if (get_user(params.stream, &src->stream) ||
^~~~~~~~~~~
arch/mips/include/asm/uaccess.h:135:42: note: expanded from macro 'get_user'
const __typeof__(*(ptr)) __user *__p = (ptr); \
^~~
In file included from sound/core/rawmidi.c:1608:
sound/core/rawmidi_compat.c:27:36: warning: taking address of packed member 'buffer_size' of class or structure 'snd_rawmidi_params32' may result in an unaligned pointer value [-Waddress-of-packed-member]
get_user(params.buffer_size, &src->buffer_size) ||
^~~~~~~~~~~~~~~~
arch/mips/include/asm/uaccess.h:135:21: note: expanded from macro 'get_user'
const __typeof__(*(ptr)) __user *__p = (ptr); \
^~~
In file included from sound/core/rawmidi.c:1608:
sound/core/rawmidi_compat.c:27:36: warning: taking address of packed member 'buffer_size' of class or structure 'snd_rawmidi_params32' may result in an unaligned pointer value [-Waddress-of-packed-member]
get_user(params.buffer_size, &src->buffer_size) ||
^~~~~~~~~~~~~~~~
arch/mips/include/asm/uaccess.h:135:42: note: expanded from macro 'get_user'
const __typeof__(*(ptr)) __user *__p = (ptr); \
^~~
In file included from sound/core/rawmidi.c:1608:
sound/core/rawmidi_compat.c:28:34: warning: taking address of packed member 'avail_min' of class or structure 'snd_rawmidi_params32' may result in an unaligned pointer value [-Waddress-of-packed-member]
get_user(params.avail_min, &src->avail_min) ||
^~~~~~~~~~~~~~
arch/mips/include/asm/uaccess.h:135:21: note: expanded from macro 'get_user'
const __typeof__(*(ptr)) __user *__p = (ptr); \
^~~
In file included from sound/core/rawmidi.c:1608:
sound/core/rawmidi_compat.c:28:34: warning: taking address of packed member 'avail_min' of class or structure 'snd_rawmidi_params32' may result in an unaligned pointer value [-Waddress-of-packed-member]
get_user(params.avail_min, &src->avail_min) ||
^~~~~~~~~~~~~~
arch/mips/include/asm/uaccess.h:135:42: note: expanded from macro 'get_user'
const __typeof__(*(ptr)) __user *__p = (ptr); \
^~~
In file included from sound/core/rawmidi.c:1608:
>> sound/core/rawmidi_compat.c:29:29: warning: taking address of packed member 'mode' of class or structure 'snd_rawmidi_params32' may result in an unaligned pointer value [-Waddress-of-packed-member]
get_user(params.mode, &src->mode) ||
^~~~~~~~~
arch/mips/include/asm/uaccess.h:135:21: note: expanded from macro 'get_user'
const __typeof__(*(ptr)) __user *__p = (ptr); \
^~~
In file included from sound/core/rawmidi.c:1608:
>> sound/core/rawmidi_compat.c:29:29: warning: taking address of packed member 'mode' of class or structure 'snd_rawmidi_params32' may result in an unaligned pointer value [-Waddress-of-packed-member]
get_user(params.mode, &src->mode) ||
^~~~~~~~~
arch/mips/include/asm/uaccess.h:135:42: note: expanded from macro 'get_user'
const __typeof__(*(ptr)) __user *__p = (ptr); \
^~~
In file included from sound/core/rawmidi.c:1608:
sound/core/rawmidi_compat.c:30:21: warning: taking address of packed member 'no_active_sensing' of class or structure 'snd_rawmidi_params32' may result in an unaligned pointer value [-Waddress-of-packed-member]
get_user(val, &src->no_active_sensing))
^~~~~~~~~~~~~~~~~~~~~~
arch/mips/include/asm/uaccess.h:135:21: note: expanded from macro 'get_user'
const __typeof__(*(ptr)) __user *__p = (ptr); \
^~~
In file included from sound/core/rawmidi.c:1608:
sound/core/rawmidi_compat.c:30:21: warning: taking address of packed member 'no_active_sensing' of class or structure 'snd_rawmidi_params32' may result in an unaligned pointer value [-Waddress-of-packed-member]
get_user(val, &src->no_active_sensing))
^~~~~~~~~~~~~~~~~~~~~~
arch/mips/include/asm/uaccess.h:135:42: note: expanded from macro 'get_user'
const __typeof__(*(ptr)) __user *__p = (ptr); \
^~~
In file included from sound/core/rawmidi.c:1608:
sound/core/rawmidi_compat.c:63:31: warning: taking address of packed member 'stream' of class or structure 'compat_snd_rawmidi_status64' may result in an unaligned pointer value [-Waddress-of-packed-member]
if (get_user(status.stream, &src->stream))
^~~~~~~~~~~
arch/mips/include/asm/uaccess.h:135:21: note: expanded from macro 'get_user'
const __typeof__(*(ptr)) __user *__p = (ptr); \
^~~
In file included from sound/core/rawmidi.c:1608:
sound/core/rawmidi_compat.c:63:31: warning: taking address of packed member 'stream' of class or structure 'compat_snd_rawmidi_status64' may result in an unaligned pointer value [-Waddress-of-packed-member]
if (get_user(status.stream, &src->stream))
^~~~~~~~~~~
arch/mips/include/asm/uaccess.h:135:42: note: expanded from macro 'get_user'
const __typeof__(*(ptr)) __user *__p = (ptr); \
^~~
12 warnings generated.
vim +29 sound/core/rawmidi_compat.c
19
20 static int snd_rawmidi_ioctl_params_compat(struct snd_rawmidi_file *rfile,
21 struct snd_rawmidi_params32 __user *src)
22 {
23 struct snd_rawmidi_params params;
24 unsigned int val;
25
26 if (get_user(params.stream, &src->stream) ||
27 get_user(params.buffer_size, &src->buffer_size) ||
28 get_user(params.avail_min, &src->avail_min) ||
> 29 get_user(params.mode, &src->mode) ||
30 get_user(val, &src->no_active_sensing))
31 return -EFAULT;
32 params.no_active_sensing = val;
33 switch (params.stream) {
34 case SNDRV_RAWMIDI_STREAM_OUTPUT:
35 if (!rfile->output)
36 return -EINVAL;
37 return snd_rawmidi_output_params(rfile->output, ¶ms);
38 case SNDRV_RAWMIDI_STREAM_INPUT:
39 if (!rfile->input)
40 return -EINVAL;
41 return snd_rawmidi_input_params(rfile->input, ¶ms);
42 }
43 return -EINVAL;
44 }
45
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx