lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202107150019.TXnrpWwY-lkp@intel.com>
Date:   Thu, 15 Jul 2021 00:34:28 +0800
From:   kernel test robot <lkp@...el.com>
To:     Mirela Rabulea <mirela.rabulea@....com>
Cc:     clang-built-linux@...glegroups.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org, Hans Verkuil <hverkuil@...all.nl>
Subject: drivers/media/platform/imx-jpeg/mxc-jpeg.c:652:12: warning: taking
 address of packed member 'height' of class or structure 'mxc_jpeg_sof' may
 result in an unaligned pointer value

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   40226a3d96ef8ab8980f032681c8bfd46d63874e
commit: 2db16c6ed72ce644d5639b3ed15e5817442db4ba media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder
date:   4 months ago
config: mips-randconfig-r004-20210714 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8d69635ed9ecf36fd0ca85906bfde17949671cbe)
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=2db16c6ed72ce644d5639b3ed15e5817442db4ba
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 2db16c6ed72ce644d5639b3ed15e5817442db4ba
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> drivers/media/platform/imx-jpeg/mxc-jpeg.c:652:12: warning: taking address of packed member 'height' of class or structure 'mxc_jpeg_sof' may result in an unaligned pointer value [-Waddress-of-packed-member]
           _bswap16(&sof->height);
                     ^~~~~~~~~~~
>> drivers/media/platform/imx-jpeg/mxc-jpeg.c:654:12: warning: taking address of packed member 'width' of class or structure 'mxc_jpeg_sof' may result in an unaligned pointer value [-Waddress-of-packed-member]
           _bswap16(&sof->width);
                     ^~~~~~~~~~
>> drivers/media/platform/imx-jpeg/mxc-jpeg.c:681:12: warning: taking address of packed member 'length' of class or structure 'mxc_jpeg_sof' may result in an unaligned pointer value [-Waddress-of-packed-member]
           _bswap16(&sof->length);
                     ^~~~~~~~~~~
>> drivers/media/platform/imx-jpeg/mxc-jpeg.c:713:12: warning: taking address of packed member 'length' of class or structure 'mxc_jpeg_sos' may result in an unaligned pointer value [-Waddress-of-packed-member]
           _bswap16(&sos->length);
                     ^~~~~~~~~~~
   4 warnings generated.


vim +652 drivers/media/platform/imx-jpeg/mxc-jpeg.c

   643	
   644	static int mxc_jpeg_fixup_sof(struct mxc_jpeg_sof *sof,
   645				      u32 fourcc,
   646				      u16 w, u16 h)
   647	{
   648		int sof_length;
   649	
   650		sof->precision = 8; /* TODO allow 8/12 bit precision*/
   651		sof->height = h;
 > 652		_bswap16(&sof->height);
   653		sof->width = w;
 > 654		_bswap16(&sof->width);
   655	
   656		switch (fourcc) {
   657		case V4L2_PIX_FMT_NV12:
   658			sof->components_no = 3;
   659			sof->comp[0].v = 0x2;
   660			sof->comp[0].h = 0x2;
   661			break;
   662		case V4L2_PIX_FMT_YUYV:
   663			sof->components_no = 3;
   664			sof->comp[0].v = 0x1;
   665			sof->comp[0].h = 0x2;
   666			break;
   667		case V4L2_PIX_FMT_YUV24:
   668		case V4L2_PIX_FMT_RGB24:
   669		default:
   670			sof->components_no = 3;
   671			break;
   672		case V4L2_PIX_FMT_ARGB32:
   673			sof->components_no = 4;
   674			break;
   675		case V4L2_PIX_FMT_GREY:
   676			sof->components_no = 1;
   677			break;
   678		}
   679		sof_length = 8 + 3 * sof->components_no;
   680		sof->length = sof_length;
 > 681		_bswap16(&sof->length);
   682	
   683		return sof_length; /* not swaped */
   684	}
   685	
   686	static int mxc_jpeg_fixup_sos(struct mxc_jpeg_sos *sos,
   687				      u32 fourcc)
   688	{
   689		int sos_length;
   690		u8 *sof_u8 = (u8 *)sos;
   691	
   692		switch (fourcc) {
   693		case V4L2_PIX_FMT_NV12:
   694			sos->components_no = 3;
   695			break;
   696		case V4L2_PIX_FMT_YUYV:
   697			sos->components_no = 3;
   698			break;
   699		case V4L2_PIX_FMT_YUV24:
   700		case V4L2_PIX_FMT_RGB24:
   701		default:
   702			sos->components_no = 3;
   703			break;
   704		case V4L2_PIX_FMT_ARGB32:
   705			sos->components_no = 4;
   706			break;
   707		case V4L2_PIX_FMT_GREY:
   708			sos->components_no = 1;
   709			break;
   710		}
   711		sos_length = 6 + 2 * sos->components_no;
   712		sos->length = sos_length;
 > 713		_bswap16(&sos->length);
   714	
   715		/* SOS ignorable bytes, not so ignorable after all */
   716		sof_u8[sos_length - 1] = 0x0;
   717		sof_u8[sos_length - 2] = 0x3f;
   718		sof_u8[sos_length - 3] = 0x0;
   719	
   720		return sos_length; /* not swaped */
   721	}
   722	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (34895 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ