mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Mirela Rabulea <mirela.rabulea@nxp.com>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, Hans Verkuil <hverkuil@xs4all.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
Date: Thu, 15 Jul 2021 00:34:28 +0800	[thread overview]
Message-ID: <202107150019.TXnrpWwY-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4822 bytes --]

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@intel.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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34895 bytes --]

                 reply	other threads:[~2021-07-14 16:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202107150019.TXnrpWwY-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=hverkuil@xs4all.nl \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mirela.rabulea@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®