[linux-next:master 2092/6266] scm_rights.c:203:18: warning: field 'cmsghdr' with variable sized type 'struct cmsghdr' not at the end of a struct or class is a GNU extension

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   6bd343537461b57f3efe5dfc5fc193a232dfef1e
commit: 2aa0cff26ed53bc8d4855292b501759435ffdd38 [2092/6266] selftest: af_unix: Test GC for SCM_RIGHTS.
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <yujie.liu@xxxxxxxxx>
| Closes: https://lore.kernel.org/r/202404160354.YBvIGPEM-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   In file included from scm_rights.c:13:
   ./../../kselftest_harness.h:1205:30: warning: format string is empty [-Wformat-zero-length]
    1205 |                               diagnostic ? "%s" : "", diagnostic);
         |                                                   ^~
>> scm_rights.c:203:18: warning: field 'cmsghdr' with variable sized type 'struct cmsghdr' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
     203 |                 struct cmsghdr cmsghdr;
         |                                ^
   2 warnings generated.


vim +203 tools/testing/selftests/net/af_unix/scm_rights.c

2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  194  
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  195  void __send_fd(struct __test_metadata *_metadata,
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  196  	       const FIXTURE_DATA(scm_rights) *self,
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  197  	       const FIXTURE_VARIANT(scm_rights) *variant,
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  198  	       int inflight, int receiver)
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  199  {
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  200  #define MSG "nop"
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  201  #define MSGLEN 3
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  202  	struct {
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25 @203  		struct cmsghdr cmsghdr;
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  204  		int fd[2];
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  205  	} cmsg = {
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  206  		.cmsghdr = {
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  207  			.cmsg_len = CMSG_LEN(sizeof(cmsg.fd)),
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  208  			.cmsg_level = SOL_SOCKET,
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  209  			.cmsg_type = SCM_RIGHTS,
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  210  		},
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  211  		.fd = {
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  212  			self->fd[inflight * 2],
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  213  			self->fd[inflight * 2],
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  214  		},
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  215  	};
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  216  	struct iovec iov = {
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  217  		.iov_base = MSG,
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  218  		.iov_len = MSGLEN,
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  219  	};
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  220  	struct msghdr msg = {
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  221  		.msg_name = NULL,
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  222  		.msg_namelen = 0,
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  223  		.msg_iov = &iov,
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  224  		.msg_iovlen = 1,
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  225  		.msg_control = &cmsg,
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  226  		.msg_controllen = CMSG_SPACE(sizeof(cmsg.fd)),
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  227  	};
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  228  	int ret;
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  229  
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  230  	ret = sendmsg(self->fd[receiver * 2 + 1], &msg, variant->flags);
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  231  	ASSERT_EQ(MSGLEN, ret);
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  232  }
2aa0cff26ed53b Kuniyuki Iwashima 2024-03-25  233  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux