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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Fri, 15 Jan 2021 01:23:26 +0800
From:   kernel test robot <lkp@...el.com>
To:     "Daniel W. S. Almeida" <dwlsalmeida@...il.com>
Cc:     kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
        linux-kernel@...r.kernel.org,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org
Subject: drivers/media/test-drivers/vidtv/vidtv_psi.c:667:31: warning: taking
 address of packed member 'bitfield2' of class or structure
 'vidtv_psi_table_pmt' may result in an unaligned pointer value

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   65f0d2414b7079556fbbcc070b3d1c9f9587606d
commit: f90cf6079bf67988f8b1ad1ade70fc89d0080905 media: vidtv: add a bridge driver
date:   4 months ago
config: mips-randconfig-r026-20210114 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 68ff52ffead2ba25cca442778ab19286000daad7)
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=f90cf6079bf67988f8b1ad1ade70fc89d0080905
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout f90cf6079bf67988f8b1ad1ade70fc89d0080905
        # 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 >>):

                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/media/test-drivers/vidtv/vidtv_psi.c:20:
   In file included from include/linux/slab.h:15:
   In file included from include/linux/gfp.h:6:
   In file included from include/linux/mmzone.h:8:
   In file included from include/linux/spinlock.h:51:
   In file included from include/linux/preempt.h:78:
   In file included from ./arch/mips/include/generated/asm/preempt.h:1:
   In file included from include/asm-generic/preempt.h:5:
   In file included from include/linux/thread_info.h:38:
   In file included from arch/mips/include/asm/thread_info.h:16:
   In file included from arch/mips/include/asm/processor.h:14:
   In file included from include/linux/atomic.h:7:
   arch/mips/include/asm/atomic.h:52:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   arch/mips/include/asm/atomic.h:45:9: note: expanded from macro 'ATOMIC_OPS'
           return xchg(&v->counter, n);                                    \
                  ^
   arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/media/test-drivers/vidtv/vidtv_psi.c:20:
   In file included from include/linux/slab.h:15:
   In file included from include/linux/gfp.h:6:
   In file included from include/linux/mmzone.h:8:
   In file included from include/linux/spinlock.h:51:
   In file included from include/linux/preempt.h:78:
   In file included from ./arch/mips/include/generated/asm/preempt.h:1:
   In file included from include/asm-generic/preempt.h:5:
   In file included from include/linux/thread_info.h:38:
   In file included from arch/mips/include/asm/thread_info.h:16:
   In file included from arch/mips/include/asm/processor.h:14:
   In file included from include/linux/atomic.h:7:
   arch/mips/include/asm/atomic.h:257:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   ATOMIC_SIP_OP(atomic, int, subu, ll, sc)
   ^
   arch/mips/include/asm/atomic.h:251:7: note: expanded from macro 'ATOMIC_SIP_OP'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/media/test-drivers/vidtv/vidtv_psi.c:20:
   In file included from include/linux/slab.h:15:
   In file included from include/linux/gfp.h:6:
   In file included from include/linux/mmzone.h:8:
   In file included from include/linux/spinlock.h:51:
   In file included from include/linux/preempt.h:78:
   In file included from ./arch/mips/include/generated/asm/preempt.h:1:
   In file included from include/asm-generic/preempt.h:5:
   In file included from include/linux/thread_info.h:38:
   In file included from arch/mips/include/asm/thread_info.h:16:
   In file included from arch/mips/include/asm/processor.h:14:
   In file included from include/linux/atomic.h:7:
   arch/mips/include/asm/atomic.h:261:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   ATOMIC_SIP_OP(atomic64, s64, dsubu, lld, scd)
   ^
   arch/mips/include/asm/atomic.h:251:7: note: expanded from macro 'ATOMIC_SIP_OP'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/media/test-drivers/vidtv/vidtv_psi.c:20:
   In file included from include/linux/slab.h:15:
   In file included from include/linux/gfp.h:6:
   In file included from include/linux/mmzone.h:8:
   In file included from include/linux/spinlock.h:59:
   In file included from include/linux/lockdep.h:14:
   In file included from include/linux/smp.h:15:
   In file included from include/linux/smp_types.h:5:
   include/linux/llist.h:222:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
           return xchg(&head->first, NULL);
                  ^
   arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/media/test-drivers/vidtv/vidtv_psi.c:20:
   In file included from include/linux/slab.h:15:
   In file included from include/linux/gfp.h:6:
   In file included from include/linux/mmzone.h:8:
   In file included from include/linux/spinlock.h:59:
   In file included from include/linux/lockdep.h:27:
   include/linux/debug_locks.h:17:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
           return xchg(&debug_locks, 0);
                  ^
   arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
>> drivers/media/test-drivers/vidtv/vidtv_psi.c:667:31: warning: taking address of packed member 'bitfield2' of class or structure 'vidtv_psi_table_pmt' may result in an unaligned pointer value [-Waddress-of-packed-member]
           vidtv_psi_set_desc_loop_len(&pmt->bitfield2, desc_loop_len, 10);
                                        ^~~~~~~~~~~~~~
>> drivers/media/test-drivers/vidtv/vidtv_psi.c:678:32: warning: taking address of packed member 'bitfield2' of class or structure 'vidtv_psi_table_pmt_stream' may result in an unaligned pointer value [-Waddress-of-packed-member]
                   vidtv_psi_set_desc_loop_len(&s->bitfield2, desc_loop_len, 10);
                                                ^~~~~~~~~~~~
>> drivers/media/test-drivers/vidtv/vidtv_psi.c:710:32: warning: taking address of packed member 'bitfield' of class or structure 'vidtv_psi_table_sdt_service' may result in an unaligned pointer value [-Waddress-of-packed-member]
                   vidtv_psi_set_desc_loop_len(&s->bitfield, desc_loop_len, 12);
                                                ^~~~~~~~~~~
   drivers/media/test-drivers/vidtv/vidtv_psi.c:97:19: warning: unused function 'vidtv_psi_sdt_serv_get_desc_loop_len' [-Wunused-function]
   static inline u16 vidtv_psi_sdt_serv_get_desc_loop_len(struct vidtv_psi_table_sdt_service *s)
                     ^
   drivers/media/test-drivers/vidtv/vidtv_psi.c:112:19: warning: unused function 'vidtv_psi_pmt_stream_get_desc_loop_len' [-Wunused-function]
   static inline u16 vidtv_psi_pmt_stream_get_desc_loop_len(struct vidtv_psi_table_pmt_stream *s)
                     ^
   drivers/media/test-drivers/vidtv/vidtv_psi.c:127:19: warning: unused function 'vidtv_psi_pmt_get_desc_loop_len' [-Wunused-function]
   static inline u16 vidtv_psi_pmt_get_desc_loop_len(struct vidtv_psi_table_pmt *p)
                     ^
   16 warnings generated.
--
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/media/test-drivers/vidtv/vidtv_channel.c:24:
   In file included from include/linux/slab.h:15:
   In file included from include/linux/gfp.h:6:
   In file included from include/linux/mmzone.h:8:
   In file included from include/linux/spinlock.h:51:
   In file included from include/linux/preempt.h:78:
   In file included from ./arch/mips/include/generated/asm/preempt.h:1:
   In file included from include/asm-generic/preempt.h:5:
   In file included from include/linux/thread_info.h:38:
   In file included from arch/mips/include/asm/thread_info.h:16:
   In file included from arch/mips/include/asm/processor.h:14:
   In file included from include/linux/atomic.h:7:
   arch/mips/include/asm/atomic.h:52:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   arch/mips/include/asm/atomic.h:45:9: note: expanded from macro 'ATOMIC_OPS'
           return xchg(&v->counter, n);                                    \
                  ^
   arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/media/test-drivers/vidtv/vidtv_channel.c:24:
   In file included from include/linux/slab.h:15:
   In file included from include/linux/gfp.h:6:
   In file included from include/linux/mmzone.h:8:
   In file included from include/linux/spinlock.h:51:
   In file included from include/linux/preempt.h:78:
   In file included from ./arch/mips/include/generated/asm/preempt.h:1:
   In file included from include/asm-generic/preempt.h:5:
   In file included from include/linux/thread_info.h:38:
   In file included from arch/mips/include/asm/thread_info.h:16:
   In file included from arch/mips/include/asm/processor.h:14:
   In file included from include/linux/atomic.h:7:
   arch/mips/include/asm/atomic.h:257:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   ATOMIC_SIP_OP(atomic, int, subu, ll, sc)
   ^
   arch/mips/include/asm/atomic.h:251:7: note: expanded from macro 'ATOMIC_SIP_OP'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/media/test-drivers/vidtv/vidtv_channel.c:24:
   In file included from include/linux/slab.h:15:
   In file included from include/linux/gfp.h:6:
   In file included from include/linux/mmzone.h:8:
   In file included from include/linux/spinlock.h:51:
   In file included from include/linux/preempt.h:78:
   In file included from ./arch/mips/include/generated/asm/preempt.h:1:
   In file included from include/asm-generic/preempt.h:5:
   In file included from include/linux/thread_info.h:38:
   In file included from arch/mips/include/asm/thread_info.h:16:
   In file included from arch/mips/include/asm/processor.h:14:
   In file included from include/linux/atomic.h:7:
   arch/mips/include/asm/atomic.h:261:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   ATOMIC_SIP_OP(atomic64, s64, dsubu, lld, scd)
   ^
   arch/mips/include/asm/atomic.h:251:7: note: expanded from macro 'ATOMIC_SIP_OP'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/media/test-drivers/vidtv/vidtv_channel.c:24:
   In file included from include/linux/slab.h:15:
   In file included from include/linux/gfp.h:6:
   In file included from include/linux/mmzone.h:8:
   In file included from include/linux/spinlock.h:59:
   In file included from include/linux/lockdep.h:14:
   In file included from include/linux/smp.h:15:
   In file included from include/linux/smp_types.h:5:
   include/linux/llist.h:222:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
           return xchg(&head->first, NULL);
                  ^
   arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/media/test-drivers/vidtv/vidtv_channel.c:24:
   In file included from include/linux/slab.h:15:
   In file included from include/linux/gfp.h:6:
   In file included from include/linux/mmzone.h:8:
   In file included from include/linux/spinlock.h:59:
   In file included from include/linux/lockdep.h:27:
   include/linux/debug_locks.h:17:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
           return xchg(&debug_locks, 0);
                  ^
   arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
>> drivers/media/test-drivers/vidtv/vidtv_channel.c:133:27: warning: taking address of packed member 'descriptor' of class or structure 'vidtv_psi_table_sdt_service' may result in an unaligned pointer value [-Waddress-of-packed-member]
                           vidtv_psi_desc_assign(&tail->descriptor, desc);
                                                  ^~~~~~~~~~~~~~~~
>> drivers/media/test-drivers/vidtv/vidtv_channel.c:231:29: warning: taking address of packed member 'descriptor' of class or structure 'vidtv_psi_table_pmt_stream' may result in an unaligned pointer value [-Waddress-of-packed-member]
                                           vidtv_psi_desc_assign(&tail->descriptor, desc);
                                                                  ^~~~~~~~~~~~~~~~
   12 warnings generated.


vim +667 drivers/media/test-drivers/vidtv/vidtv_psi.c

   655	
   656	void vidtv_psi_pmt_table_update_sec_len(struct vidtv_psi_table_pmt *pmt)
   657	{
   658		/* see ISO/IEC 13818-1 : 2000 p.46 */
   659		u16 length = 0;
   660		struct vidtv_psi_table_pmt_stream *s = pmt->stream;
   661		u16 desc_loop_len;
   662	
   663		/* from immediately after 'section_length' until 'program_info_length'*/
   664		length += PMT_LEN_UNTIL_PROGRAM_INFO_LENGTH;
   665	
   666		desc_loop_len = vidtv_psi_desc_comp_loop_len(pmt->descriptor);
 > 667		vidtv_psi_set_desc_loop_len(&pmt->bitfield2, desc_loop_len, 10);
   668	
   669		length += desc_loop_len;
   670	
   671		while (s) {
   672			/* skip both pointers at the end */
   673			length += sizeof(struct vidtv_psi_table_pmt_stream) -
   674				  sizeof(struct vidtv_psi_desc *) -
   675				  sizeof(struct vidtv_psi_table_pmt_stream *);
   676	
   677			desc_loop_len = vidtv_psi_desc_comp_loop_len(s->descriptor);
 > 678			vidtv_psi_set_desc_loop_len(&s->bitfield2, desc_loop_len, 10);
   679	
   680			length += desc_loop_len;
   681	
   682			s = s->next;
   683		}
   684	
   685		length += CRC_SIZE_IN_BYTES;
   686	
   687		vidtv_psi_set_sec_len(&pmt->header, length);
   688	}
   689	
   690	void vidtv_psi_sdt_table_update_sec_len(struct vidtv_psi_table_sdt *sdt)
   691	{
   692		/* see ETSI EN 300 468 V 1.10.1 p.24 */
   693		u16 length = 0;
   694		struct vidtv_psi_table_sdt_service *s = sdt->service;
   695		u16 desc_loop_len;
   696	
   697		/*
   698		 * from immediately after 'section_length' until
   699		 * 'reserved_for_future_use'
   700		 */
   701		length += SDT_LEN_UNTIL_RESERVED_FOR_FUTURE_USE;
   702	
   703		while (s) {
   704			/* skip both pointers at the end */
   705			length += sizeof(struct vidtv_psi_table_sdt_service) -
   706				  sizeof(struct vidtv_psi_desc *) -
   707				  sizeof(struct vidtv_psi_table_sdt_service *);
   708	
   709			desc_loop_len = vidtv_psi_desc_comp_loop_len(s->descriptor);
 > 710			vidtv_psi_set_desc_loop_len(&s->bitfield, desc_loop_len, 12);
   711	
   712			length += desc_loop_len;
   713	
   714			s = s->next;
   715		}
   716	
   717		length += CRC_SIZE_IN_BYTES;
   718	
   719		vidtv_psi_set_sec_len(&sdt->header, length);
   720	}
   721	

---
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" (36684 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ