linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sound/soc/codecs/wm_adsp.c:1490:32: warning: taking address of packed member 'name' of class or structure 'wm_adsp_host_buf_coeff_v1' may result in an unaligned pointer value
@ 2022-07-25 22:29 kernel test robot
  2022-07-25 22:34 ` Nathan Chancellor
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2022-07-25 22:29 UTC (permalink / raw)
  To: Simon Trimmer; +Cc: llvm, kbuild-all, linux-kernel, Mark Brown

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e0dccc3b76fb35bb257b4118367a883073d7390e
commit: 353bb6a5f2ac495f289b7c7a528c7d134c9a8ec4 ASoC: wm_adsp: Compressed stream DSP memory structs should be __packed
date:   5 months ago
config: arm-randconfig-r013-20220724 (https://download.01.org/0day-ci/archive/20220726/202207260648.ERQjXCRB-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 9e88cbcc403bdf82f29259ad60ff60a8fc4434a1)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=353bb6a5f2ac495f289b7c7a528c7d134c9a8ec4
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 353bb6a5f2ac495f289b7c7a528c7d134c9a8ec4
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash sound/soc/codecs/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> sound/soc/codecs/wm_adsp.c:1490:32: warning: taking address of packed member 'name' of class or structure 'wm_adsp_host_buf_coeff_v1' may result in an unaligned pointer value [-Waddress-of-packed-member]
           cs_dsp_remove_padding((u32 *)&coeff_v1.name, ARRAY_SIZE(coeff_v1.name));
                                         ^~~~~~~~~~~~~
   1 warning generated.


vim +1490 sound/soc/codecs/wm_adsp.c

d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1434  
0700bc2fb94c28 Simon Trimmer      2021-09-13  1435  static int wm_adsp_buffer_parse_coeff(struct cs_dsp_coeff_ctl *cs_ctl)
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1436  {
4f2d4eabf57718 Stuart Henderson   2019-02-22  1437  	struct wm_adsp_host_buf_coeff_v1 coeff_v1;
a792af69b08fd7 Charles Keepax     2019-02-22  1438  	struct wm_adsp_compr_buf *buf;
e146820215910d Simon Trimmer      2021-09-13  1439  	struct wm_adsp *dsp = container_of(cs_ctl->dsp, struct wm_adsp, cs_dsp);
04ae08596737c4 Charles Keepax     2021-09-13  1440  	unsigned int version;
a792af69b08fd7 Charles Keepax     2019-02-22  1441  	int ret, i;
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1442  
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1443  	for (i = 0; i < 5; ++i) {
a887f9c7a4d37a Charles Keepax     2022-02-10  1444  		ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, &coeff_v1,
a887f9c7a4d37a Charles Keepax     2022-02-10  1445  					     min(cs_ctl->len, sizeof(coeff_v1)));
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1446  		if (ret < 0)
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1447  			return ret;
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1448  
04ae08596737c4 Charles Keepax     2021-09-13  1449  		if (coeff_v1.host_buf_ptr)
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1450  			break;
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1451  
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1452  		usleep_range(1000, 2000);
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1453  	}
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1454  
04ae08596737c4 Charles Keepax     2021-09-13  1455  	if (!coeff_v1.host_buf_ptr) {
0700bc2fb94c28 Simon Trimmer      2021-09-13  1456  		adsp_err(dsp, "Failed to acquire host buffer\n");
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1457  		return -EIO;
a792af69b08fd7 Charles Keepax     2019-02-22  1458  	}
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1459  
0700bc2fb94c28 Simon Trimmer      2021-09-13  1460  	buf = wm_adsp_buffer_alloc(dsp);
a792af69b08fd7 Charles Keepax     2019-02-22  1461  	if (!buf)
a792af69b08fd7 Charles Keepax     2019-02-22  1462  		return -ENOMEM;
a792af69b08fd7 Charles Keepax     2019-02-22  1463  
0700bc2fb94c28 Simon Trimmer      2021-09-13  1464  	buf->host_buf_mem_type = cs_ctl->alg_region.type;
04ae08596737c4 Charles Keepax     2021-09-13  1465  	buf->host_buf_ptr = be32_to_cpu(coeff_v1.host_buf_ptr);
a792af69b08fd7 Charles Keepax     2019-02-22  1466  
a792af69b08fd7 Charles Keepax     2019-02-22  1467  	ret = wm_adsp_buffer_populate(buf);
a792af69b08fd7 Charles Keepax     2019-02-22  1468  	if (ret < 0)
a792af69b08fd7 Charles Keepax     2019-02-22  1469  		return ret;
a792af69b08fd7 Charles Keepax     2019-02-22  1470  
4f2d4eabf57718 Stuart Henderson   2019-02-22  1471  	/*
4f2d4eabf57718 Stuart Henderson   2019-02-22  1472  	 * v0 host_buffer coefficients didn't have versioning, so if the
4f2d4eabf57718 Stuart Henderson   2019-02-22  1473  	 * control is one word, assume version 0.
4f2d4eabf57718 Stuart Henderson   2019-02-22  1474  	 */
0700bc2fb94c28 Simon Trimmer      2021-09-13  1475  	if (cs_ctl->len == 4) {
0d3fba3e7a5669 Charles Keepax     2019-02-22  1476  		compr_dbg(buf, "host_buf_ptr=%x\n", buf->host_buf_ptr);
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1477  		return 0;
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1478  	}
d52ed4b0bc73c1 Richard Fitzgerald 2018-07-19  1479  
a0b653e89a3afd Richard Fitzgerald 2020-12-30  1480  	version = be32_to_cpu(coeff_v1.versions) & HOST_BUF_COEFF_COMPAT_VER_MASK;
a0b653e89a3afd Richard Fitzgerald 2020-12-30  1481  	version >>= HOST_BUF_COEFF_COMPAT_VER_SHIFT;
4f2d4eabf57718 Stuart Henderson   2019-02-22  1482  
a0b653e89a3afd Richard Fitzgerald 2020-12-30  1483  	if (version > HOST_BUF_COEFF_SUPPORTED_COMPAT_VER) {
0700bc2fb94c28 Simon Trimmer      2021-09-13  1484  		adsp_err(dsp,
4f2d4eabf57718 Stuart Henderson   2019-02-22  1485  			 "Host buffer coeff ver %u > supported version %u\n",
a0b653e89a3afd Richard Fitzgerald 2020-12-30  1486  			 version, HOST_BUF_COEFF_SUPPORTED_COMPAT_VER);
4f2d4eabf57718 Stuart Henderson   2019-02-22  1487  		return -EINVAL;
4f2d4eabf57718 Stuart Henderson   2019-02-22  1488  	}
4f2d4eabf57718 Stuart Henderson   2019-02-22  1489  
5beb8eeade2c03 Simon Trimmer      2021-09-13 @1490  	cs_dsp_remove_padding((u32 *)&coeff_v1.name, ARRAY_SIZE(coeff_v1.name));
4f2d4eabf57718 Stuart Henderson   2019-02-22  1491  
0700bc2fb94c28 Simon Trimmer      2021-09-13  1492  	buf->name = kasprintf(GFP_KERNEL, "%s-dsp-%s", dsp->part,
4f2d4eabf57718 Stuart Henderson   2019-02-22  1493  			      (char *)&coeff_v1.name);
4f2d4eabf57718 Stuart Henderson   2019-02-22  1494  
0d3fba3e7a5669 Charles Keepax     2019-02-22  1495  	compr_dbg(buf, "host_buf_ptr=%x coeff version %u\n",
a0b653e89a3afd Richard Fitzgerald 2020-12-30  1496  		  buf->host_buf_ptr, version);
4f2d4eabf57718 Stuart Henderson   2019-02-22  1497  
a0b653e89a3afd Richard Fitzgerald 2020-12-30  1498  	return version;
4f2d4eabf57718 Stuart Henderson   2019-02-22  1499  }
4f2d4eabf57718 Stuart Henderson   2019-02-22  1500  

:::::: The code at line 1490 was first introduced by commit
:::::: 5beb8eeade2c03b55ae729c05bb9fa245633fe74 ASoC: wm_adsp: Rename generic DSP support

:::::: TO: Simon Trimmer <simont@opensource.cirrus.com>
:::::: CC: Mark Brown <broonie@kernel.org>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sound/soc/codecs/wm_adsp.c:1490:32: warning: taking address of packed member 'name' of class or structure 'wm_adsp_host_buf_coeff_v1' may result in an unaligned pointer value
  2022-07-25 22:29 sound/soc/codecs/wm_adsp.c:1490:32: warning: taking address of packed member 'name' of class or structure 'wm_adsp_host_buf_coeff_v1' may result in an unaligned pointer value kernel test robot
@ 2022-07-25 22:34 ` Nathan Chancellor
  2022-07-25 22:36   ` Nathan Chancellor
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2022-07-25 22:34 UTC (permalink / raw)
  To: kernel test robot
  Cc: Simon Trimmer, llvm, kbuild-all, linux-kernel, Mark Brown

On Tue, Jul 26, 2022 at 06:29:46AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   e0dccc3b76fb35bb257b4118367a883073d7390e
> commit: 353bb6a5f2ac495f289b7c7a528c7d134c9a8ec4 ASoC: wm_adsp: Compressed stream DSP memory structs should be __packed
> date:   5 months ago
> config: arm-randconfig-r013-20220724 (https://download.01.org/0day-ci/archive/20220726/202207260648.ERQjXCRB-lkp@intel.com/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 9e88cbcc403bdf82f29259ad60ff60a8fc4434a1)
> 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 arm cross compiling tool for clang build
>         # apt-get install binutils-arm-linux-gnueabi
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=353bb6a5f2ac495f289b7c7a528c7d134c9a8ec4
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout 353bb6a5f2ac495f289b7c7a528c7d134c9a8ec4
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash sound/soc/codecs/
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
> >> sound/soc/codecs/wm_adsp.c:1490:32: warning: taking address of packed member 'name' of class or structure 'wm_adsp_host_buf_coeff_v1' may result in an unaligned pointer value [-Waddress-of-packed-member]
>            cs_dsp_remove_padding((u32 *)&coeff_v1.name, ARRAY_SIZE(coeff_v1.name));
>                                          ^~~~~~~~~~~~~
>    1 warning generated.

This warning is disabled in the main Makefile but a recent change in
LLVM has caused that check to fail, sorry for the noise :(

https://github.com/ClangBuiltLinux/linux/issues/1674

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sound/soc/codecs/wm_adsp.c:1490:32: warning: taking address of packed member 'name' of class or structure 'wm_adsp_host_buf_coeff_v1' may result in an unaligned pointer value
  2022-07-25 22:34 ` Nathan Chancellor
@ 2022-07-25 22:36   ` Nathan Chancellor
  0 siblings, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2022-07-25 22:36 UTC (permalink / raw)
  To: kernel test robot
  Cc: Simon Trimmer, llvm, kbuild-all, linux-kernel, Mark Brown

On Mon, Jul 25, 2022 at 03:34:15PM -0700, Nathan Chancellor wrote:
> On Tue, Jul 26, 2022 at 06:29:46AM +0800, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head:   e0dccc3b76fb35bb257b4118367a883073d7390e
> > commit: 353bb6a5f2ac495f289b7c7a528c7d134c9a8ec4 ASoC: wm_adsp: Compressed stream DSP memory structs should be __packed
> > date:   5 months ago
> > config: arm-randconfig-r013-20220724 (https://download.01.org/0day-ci/archive/20220726/202207260648.ERQjXCRB-lkp@intel.com/config)
> > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 9e88cbcc403bdf82f29259ad60ff60a8fc4434a1)
> > 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 arm cross compiling tool for clang build
> >         # apt-get install binutils-arm-linux-gnueabi
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=353bb6a5f2ac495f289b7c7a528c7d134c9a8ec4
> >         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> >         git fetch --no-tags linus master
> >         git checkout 353bb6a5f2ac495f289b7c7a528c7d134c9a8ec4
> >         # save the config file
> >         mkdir build_dir && cp config build_dir/.config
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash sound/soc/codecs/
> > 
> > If you fix the issue, kindly add following tag where applicable
> > Reported-by: kernel test robot <lkp@intel.com>
> > 
> > All warnings (new ones prefixed by >>):
> > 
> > >> sound/soc/codecs/wm_adsp.c:1490:32: warning: taking address of packed member 'name' of class or structure 'wm_adsp_host_buf_coeff_v1' may result in an unaligned pointer value [-Waddress-of-packed-member]
> >            cs_dsp_remove_padding((u32 *)&coeff_v1.name, ARRAY_SIZE(coeff_v1.name));
> >                                          ^~~~~~~~~~~~~
> >    1 warning generated.
> 
> This warning is disabled in the main Makefile but a recent change in
> LLVM has caused that check to fail, sorry for the noise :(
> 
> https://github.com/ClangBuiltLinux/linux/issues/1674

Ah nevermind, looks like Fangrui already worked around this, it should
be resolved on the next LLVM uprev:

https://github.com/llvm/llvm-project/commit/1d23f6c5a4f6ebb101c282f8f506588fe4d9e92f

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-25 22:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-25 22:29 sound/soc/codecs/wm_adsp.c:1490:32: warning: taking address of packed member 'name' of class or structure 'wm_adsp_host_buf_coeff_v1' may result in an unaligned pointer value kernel test robot
2022-07-25 22:34 ` Nathan Chancellor
2022-07-25 22:36   ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).