All of lore.kernel.org
 help / color / mirror / Atom feed
* net/ipv4/ip_sockglue.c:838:7: warning: taking address of packed member 'gf_group' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value
@ 2021-11-05  0:05 ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-11-05  0:05 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: llvm, kbuild-all, linux-kernel

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d4439a1189f93d0ac1eaf0197db8e6b3e197d5c7
commit: db243b796439c0caba47865564d8acd18a301d18 net/ipv4/ipv6: Replace one-element arraya with flexible-array members
date:   3 months ago
config: mips-randconfig-r011-20211101 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 82ed106567063ea269c6d5669278b733e173a42f)
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=db243b796439c0caba47865564d8acd18a301d18
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout db243b796439c0caba47865564d8acd18a301d18
        # save the attached .config 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@intel.com>

All warnings (new ones prefixed by >>):

>> net/ipv4/ip_sockglue.c:838:7: warning: taking address of packed member 'gf_group' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
                                    &gf32->gf_group, gf32->gf_slist_flex);
                                     ^~~~~~~~~~~~~~
>> net/ipv4/ip_sockglue.c:1509:29: warning: taking address of packed member 'gf_fmode' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_fmode, &p->gf_fmode) ||
                                      ^~~~~~~~~~~
   arch/mips/include/asm/uaccess.h:109:15: note: expanded from macro 'put_user'
           __typeof__(*(ptr)) __user *__p = (ptr);                         \
                        ^~~
>> net/ipv4/ip_sockglue.c:1509:29: warning: taking address of packed member 'gf_fmode' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_fmode, &p->gf_fmode) ||
                                      ^~~~~~~~~~~
   arch/mips/include/asm/uaccess.h:109:36: note: expanded from macro 'put_user'
           __typeof__(*(ptr)) __user *__p = (ptr);                         \
                                             ^~~
>> net/ipv4/ip_sockglue.c:1510:30: warning: taking address of packed member 'gf_numsrc' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_numsrc, &p->gf_numsrc))
                                       ^~~~~~~~~~~~
   arch/mips/include/asm/uaccess.h:109:15: note: expanded from macro 'put_user'
           __typeof__(*(ptr)) __user *__p = (ptr);                         \
                        ^~~
>> net/ipv4/ip_sockglue.c:1510:30: warning: taking address of packed member 'gf_numsrc' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_numsrc, &p->gf_numsrc))
                                       ^~~~~~~~~~~~
   arch/mips/include/asm/uaccess.h:109:36: note: expanded from macro 'put_user'
           __typeof__(*(ptr)) __user *__p = (ptr);                         \
                                             ^~~
   5 warnings generated.


vim +838 net/ipv4/ip_sockglue.c

   799	
   800	static int compat_ip_set_mcast_msfilter(struct sock *sk, sockptr_t optval,
   801			int optlen)
   802	{
   803		const int size0 = offsetof(struct compat_group_filter, gf_slist_flex);
   804		struct compat_group_filter *gf32;
   805		unsigned int n;
   806		void *p;
   807		int err;
   808	
   809		if (optlen < size0)
   810			return -EINVAL;
   811		if (optlen > sysctl_optmem_max - 4)
   812			return -ENOBUFS;
   813	
   814		p = kmalloc(optlen + 4, GFP_KERNEL);
   815		if (!p)
   816			return -ENOMEM;
   817		gf32 = p + 4; /* we want ->gf_group and ->gf_slist_flex aligned */
   818	
   819		err = -EFAULT;
   820		if (copy_from_sockptr(gf32, optval, optlen))
   821			goto out_free_gsf;
   822	
   823		/* numsrc >= (4G-140)/128 overflow in 32 bits */
   824		n = gf32->gf_numsrc;
   825		err = -ENOBUFS;
   826		if (n >= 0x1ffffff)
   827			goto out_free_gsf;
   828	
   829		err = -EINVAL;
   830		if (offsetof(struct compat_group_filter, gf_slist_flex[n]) > optlen)
   831			goto out_free_gsf;
   832	
   833		/* numsrc >= (4G-140)/128 overflow in 32 bits */
   834		err = -ENOBUFS;
   835		if (n > sock_net(sk)->ipv4.sysctl_igmp_max_msf)
   836			goto out_free_gsf;
   837		err = set_mcast_msfilter(sk, gf32->gf_interface, n, gf32->gf_fmode,
 > 838					 &gf32->gf_group, gf32->gf_slist_flex);
   839	out_free_gsf:
   840		kfree(p);
   841		return err;
   842	}
   843	

---
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: 33301 bytes --]

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

* net/ipv4/ip_sockglue.c:838:7: warning: taking address of packed member 'gf_group' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value
@ 2021-11-05  0:05 ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-11-05  0:05 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d4439a1189f93d0ac1eaf0197db8e6b3e197d5c7
commit: db243b796439c0caba47865564d8acd18a301d18 net/ipv4/ipv6: Replace one-element arraya with flexible-array members
date:   3 months ago
config: mips-randconfig-r011-20211101 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 82ed106567063ea269c6d5669278b733e173a42f)
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=db243b796439c0caba47865564d8acd18a301d18
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout db243b796439c0caba47865564d8acd18a301d18
        # save the attached .config 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@intel.com>

All warnings (new ones prefixed by >>):

>> net/ipv4/ip_sockglue.c:838:7: warning: taking address of packed member 'gf_group' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
                                    &gf32->gf_group, gf32->gf_slist_flex);
                                     ^~~~~~~~~~~~~~
>> net/ipv4/ip_sockglue.c:1509:29: warning: taking address of packed member 'gf_fmode' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_fmode, &p->gf_fmode) ||
                                      ^~~~~~~~~~~
   arch/mips/include/asm/uaccess.h:109:15: note: expanded from macro 'put_user'
           __typeof__(*(ptr)) __user *__p = (ptr);                         \
                        ^~~
>> net/ipv4/ip_sockglue.c:1509:29: warning: taking address of packed member 'gf_fmode' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_fmode, &p->gf_fmode) ||
                                      ^~~~~~~~~~~
   arch/mips/include/asm/uaccess.h:109:36: note: expanded from macro 'put_user'
           __typeof__(*(ptr)) __user *__p = (ptr);                         \
                                             ^~~
>> net/ipv4/ip_sockglue.c:1510:30: warning: taking address of packed member 'gf_numsrc' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_numsrc, &p->gf_numsrc))
                                       ^~~~~~~~~~~~
   arch/mips/include/asm/uaccess.h:109:15: note: expanded from macro 'put_user'
           __typeof__(*(ptr)) __user *__p = (ptr);                         \
                        ^~~
>> net/ipv4/ip_sockglue.c:1510:30: warning: taking address of packed member 'gf_numsrc' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_numsrc, &p->gf_numsrc))
                                       ^~~~~~~~~~~~
   arch/mips/include/asm/uaccess.h:109:36: note: expanded from macro 'put_user'
           __typeof__(*(ptr)) __user *__p = (ptr);                         \
                                             ^~~
   5 warnings generated.


vim +838 net/ipv4/ip_sockglue.c

   799	
   800	static int compat_ip_set_mcast_msfilter(struct sock *sk, sockptr_t optval,
   801			int optlen)
   802	{
   803		const int size0 = offsetof(struct compat_group_filter, gf_slist_flex);
   804		struct compat_group_filter *gf32;
   805		unsigned int n;
   806		void *p;
   807		int err;
   808	
   809		if (optlen < size0)
   810			return -EINVAL;
   811		if (optlen > sysctl_optmem_max - 4)
   812			return -ENOBUFS;
   813	
   814		p = kmalloc(optlen + 4, GFP_KERNEL);
   815		if (!p)
   816			return -ENOMEM;
   817		gf32 = p + 4; /* we want ->gf_group and ->gf_slist_flex aligned */
   818	
   819		err = -EFAULT;
   820		if (copy_from_sockptr(gf32, optval, optlen))
   821			goto out_free_gsf;
   822	
   823		/* numsrc >= (4G-140)/128 overflow in 32 bits */
   824		n = gf32->gf_numsrc;
   825		err = -ENOBUFS;
   826		if (n >= 0x1ffffff)
   827			goto out_free_gsf;
   828	
   829		err = -EINVAL;
   830		if (offsetof(struct compat_group_filter, gf_slist_flex[n]) > optlen)
   831			goto out_free_gsf;
   832	
   833		/* numsrc >= (4G-140)/128 overflow in 32 bits */
   834		err = -ENOBUFS;
   835		if (n > sock_net(sk)->ipv4.sysctl_igmp_max_msf)
   836			goto out_free_gsf;
   837		err = set_mcast_msfilter(sk, gf32->gf_interface, n, gf32->gf_fmode,
 > 838					 &gf32->gf_group, gf32->gf_slist_flex);
   839	out_free_gsf:
   840		kfree(p);
   841		return err;
   842	}
   843	

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

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

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

* net/ipv4/ip_sockglue.c:838:7: warning: taking address of packed member 'gf_group' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value
@ 2022-07-25  2:12 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-07-25  2:12 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: llvm, kbuild-all, linux-kernel

Hi Gustavo,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e0dccc3b76fb35bb257b4118367a883073d7390e
commit: db243b796439c0caba47865564d8acd18a301d18 net/ipv4/ipv6: Replace one-element arraya with flexible-array members
date:   12 months ago
config: arm-colibri_pxa300_defconfig (https://download.01.org/0day-ci/archive/20220725/202207251043.l8Cq3k4Z-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 12fbd2d377e396ad61bce56d71c98a1eb1bebfa9)
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=db243b796439c0caba47865564d8acd18a301d18
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout db243b796439c0caba47865564d8acd18a301d18
        # 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 net/ipv4/ net/ipv6/

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 >>):

>> net/ipv4/ip_sockglue.c:838:7: warning: taking address of packed member 'gf_group' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
                                    &gf32->gf_group, gf32->gf_slist_flex);
                                     ^~~~~~~~~~~~~~
>> net/ipv4/ip_sockglue.c:1509:29: warning: taking address of packed member 'gf_fmode' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_fmode, &p->gf_fmode) ||
                                      ^~~~~~~~~~~
   arch/arm/include/asm/uaccess.h:406:26: note: expanded from macro 'put_user'
           __put_user_switch((x), (ptr), __pu_err, __put_user_check);      \
                                   ^~~
   arch/arm/include/asm/uaccess.h:388:22: note: expanded from macro '__put_user_switch'
                   const __typeof__(*(ptr)) __user *__pu_ptr = (ptr);      \
                                      ^~~
>> net/ipv4/ip_sockglue.c:1509:29: warning: taking address of packed member 'gf_fmode' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_fmode, &p->gf_fmode) ||
                                      ^~~~~~~~~~~
   arch/arm/include/asm/uaccess.h:406:26: note: expanded from macro 'put_user'
           __put_user_switch((x), (ptr), __pu_err, __put_user_check);      \
                                   ^~~
   arch/arm/include/asm/uaccess.h:389:16: note: expanded from macro '__put_user_switch'
                   __typeof__(*(ptr)) __pu_val = (x);                      \
                                ^~~
>> net/ipv4/ip_sockglue.c:1509:29: warning: taking address of packed member 'gf_fmode' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_fmode, &p->gf_fmode) ||
                                      ^~~~~~~~~~~
   arch/arm/include/asm/uaccess.h:406:26: note: expanded from macro 'put_user'
           __put_user_switch((x), (ptr), __pu_err, __put_user_check);      \
                                   ^~~
   arch/arm/include/asm/uaccess.h:393:20: note: expanded from macro '__put_user_switch'
                   switch (sizeof(*(ptr))) {                               \
                                    ^~~
>> net/ipv4/ip_sockglue.c:1510:30: warning: taking address of packed member 'gf_numsrc' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_numsrc, &p->gf_numsrc))
                                       ^~~~~~~~~~~~
   arch/arm/include/asm/uaccess.h:406:26: note: expanded from macro 'put_user'
           __put_user_switch((x), (ptr), __pu_err, __put_user_check);      \
                                   ^~~
   arch/arm/include/asm/uaccess.h:388:22: note: expanded from macro '__put_user_switch'
                   const __typeof__(*(ptr)) __user *__pu_ptr = (ptr);      \
                                      ^~~
>> net/ipv4/ip_sockglue.c:1510:30: warning: taking address of packed member 'gf_numsrc' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_numsrc, &p->gf_numsrc))
                                       ^~~~~~~~~~~~
   arch/arm/include/asm/uaccess.h:406:26: note: expanded from macro 'put_user'
           __put_user_switch((x), (ptr), __pu_err, __put_user_check);      \
                                   ^~~
   arch/arm/include/asm/uaccess.h:389:16: note: expanded from macro '__put_user_switch'
                   __typeof__(*(ptr)) __pu_val = (x);                      \
                                ^~~
>> net/ipv4/ip_sockglue.c:1510:30: warning: taking address of packed member 'gf_numsrc' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_numsrc, &p->gf_numsrc))
                                       ^~~~~~~~~~~~
   arch/arm/include/asm/uaccess.h:406:26: note: expanded from macro 'put_user'
           __put_user_switch((x), (ptr), __pu_err, __put_user_check);      \
                                   ^~~
   arch/arm/include/asm/uaccess.h:393:20: note: expanded from macro '__put_user_switch'
                   switch (sizeof(*(ptr))) {                               \
                                    ^~~
   7 warnings generated.
--
>> net/ipv6/ipv6_sockglue.c:1111:29: warning: taking address of packed member 'gf_fmode' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_fmode, &p->gf_fmode) ||
                                      ^~~~~~~~~~~
   arch/arm/include/asm/uaccess.h:406:26: note: expanded from macro 'put_user'
           __put_user_switch((x), (ptr), __pu_err, __put_user_check);      \
                                   ^~~
   arch/arm/include/asm/uaccess.h:388:22: note: expanded from macro '__put_user_switch'
                   const __typeof__(*(ptr)) __user *__pu_ptr = (ptr);      \
                                      ^~~
>> net/ipv6/ipv6_sockglue.c:1111:29: warning: taking address of packed member 'gf_fmode' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_fmode, &p->gf_fmode) ||
                                      ^~~~~~~~~~~
   arch/arm/include/asm/uaccess.h:406:26: note: expanded from macro 'put_user'
           __put_user_switch((x), (ptr), __pu_err, __put_user_check);      \
                                   ^~~
   arch/arm/include/asm/uaccess.h:389:16: note: expanded from macro '__put_user_switch'
                   __typeof__(*(ptr)) __pu_val = (x);                      \
                                ^~~
>> net/ipv6/ipv6_sockglue.c:1111:29: warning: taking address of packed member 'gf_fmode' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_fmode, &p->gf_fmode) ||
                                      ^~~~~~~~~~~
   arch/arm/include/asm/uaccess.h:406:26: note: expanded from macro 'put_user'
           __put_user_switch((x), (ptr), __pu_err, __put_user_check);      \
                                   ^~~
   arch/arm/include/asm/uaccess.h:393:20: note: expanded from macro '__put_user_switch'
                   switch (sizeof(*(ptr))) {                               \
                                    ^~~
>> net/ipv6/ipv6_sockglue.c:1112:30: warning: taking address of packed member 'gf_numsrc' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_numsrc, &p->gf_numsrc))
                                       ^~~~~~~~~~~~
   arch/arm/include/asm/uaccess.h:406:26: note: expanded from macro 'put_user'
           __put_user_switch((x), (ptr), __pu_err, __put_user_check);      \
                                   ^~~
   arch/arm/include/asm/uaccess.h:388:22: note: expanded from macro '__put_user_switch'
                   const __typeof__(*(ptr)) __user *__pu_ptr = (ptr);      \
                                      ^~~
>> net/ipv6/ipv6_sockglue.c:1112:30: warning: taking address of packed member 'gf_numsrc' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_numsrc, &p->gf_numsrc))
                                       ^~~~~~~~~~~~
   arch/arm/include/asm/uaccess.h:406:26: note: expanded from macro 'put_user'
           __put_user_switch((x), (ptr), __pu_err, __put_user_check);      \
                                   ^~~
   arch/arm/include/asm/uaccess.h:389:16: note: expanded from macro '__put_user_switch'
                   __typeof__(*(ptr)) __pu_val = (x);                      \
                                ^~~
>> net/ipv6/ipv6_sockglue.c:1112:30: warning: taking address of packed member 'gf_numsrc' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value [-Waddress-of-packed-member]
               put_user(gf.gf_numsrc, &p->gf_numsrc))
                                       ^~~~~~~~~~~~
   arch/arm/include/asm/uaccess.h:406:26: note: expanded from macro 'put_user'
           __put_user_switch((x), (ptr), __pu_err, __put_user_check);      \
                                   ^~~
   arch/arm/include/asm/uaccess.h:393:20: note: expanded from macro '__put_user_switch'
                   switch (sizeof(*(ptr))) {                               \
                                    ^~~
   6 warnings generated.


vim +838 net/ipv4/ip_sockglue.c

   799	
   800	static int compat_ip_set_mcast_msfilter(struct sock *sk, sockptr_t optval,
   801			int optlen)
   802	{
   803		const int size0 = offsetof(struct compat_group_filter, gf_slist_flex);
   804		struct compat_group_filter *gf32;
   805		unsigned int n;
   806		void *p;
   807		int err;
   808	
   809		if (optlen < size0)
   810			return -EINVAL;
   811		if (optlen > sysctl_optmem_max - 4)
   812			return -ENOBUFS;
   813	
   814		p = kmalloc(optlen + 4, GFP_KERNEL);
   815		if (!p)
   816			return -ENOMEM;
   817		gf32 = p + 4; /* we want ->gf_group and ->gf_slist_flex aligned */
   818	
   819		err = -EFAULT;
   820		if (copy_from_sockptr(gf32, optval, optlen))
   821			goto out_free_gsf;
   822	
   823		/* numsrc >= (4G-140)/128 overflow in 32 bits */
   824		n = gf32->gf_numsrc;
   825		err = -ENOBUFS;
   826		if (n >= 0x1ffffff)
   827			goto out_free_gsf;
   828	
   829		err = -EINVAL;
   830		if (offsetof(struct compat_group_filter, gf_slist_flex[n]) > optlen)
   831			goto out_free_gsf;
   832	
   833		/* numsrc >= (4G-140)/128 overflow in 32 bits */
   834		err = -ENOBUFS;
   835		if (n > sock_net(sk)->ipv4.sysctl_igmp_max_msf)
   836			goto out_free_gsf;
   837		err = set_mcast_msfilter(sk, gf32->gf_interface, n, gf32->gf_fmode,
 > 838					 &gf32->gf_group, gf32->gf_slist_flex);
   839	out_free_gsf:
   840		kfree(p);
   841		return err;
   842	}
   843	

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

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05  0:05 net/ipv4/ip_sockglue.c:838:7: warning: taking address of packed member 'gf_group' of class or structure 'compat_group_filter::(anonymous union)::(anonymous)' may result in an unaligned pointer value kernel test robot
2021-11-05  0:05 ` kernel test robot
2022-07-25  2:12 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.