tree:   https://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux.git 
next
head:   f4b4f5fe58a55a4212a263d9d44416778ca6e7a7
commit: 74cab0be9a5d9d91471c4dee7311dcdfc1c0a6f4 [11/21] liveupdate: validate 
session type before performing operation
config: x86_64-buildonly-randconfig-003-20260601 
(https://download.01.org/0day-ci/archive/20260601/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 
87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20260601/[email protected]/reproduce)

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 <[email protected]>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> kernel/liveupdate/luo_session.c:344:48: error: too few arguments provided to 
>> function-like macro invocation
     344 |                  struct liveupdate_session_retrieve_fd, token),
         |                                                              ^
   kernel/liveupdate/luo_session.c:327:9: note: macro 'IOCTL_OP' defined here
     327 | #define IOCTL_OP(_ioctl, _fn, _struct, _last, _type)                 
          \
         |         ^
>> kernel/liveupdate/luo_session.c:343:2: error: use of undeclared identifier 
>> 'IOCTL_OP'
     343 |         IOCTL_OP(LIVEUPDATE_SESSION_RETRIEVE_FD, 
luo_session_retrieve_fd,
         |         ^
>> kernel/liveupdate/luo_session.c:378:6: error: invalid application of 
>> 'sizeof' to an incomplete type 'const struct luo_ioctl_op[]'
     378 |             ARRAY_SIZE(luo_session_ioctl_ops)) {
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
         |                                ^~~~~
   3 errors generated.


vim +344 kernel/liveupdate/luo_session.c

16cec0d265219f Pasha Tatashin          2025-11-25  326  
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  327) #define 
IOCTL_OP(_ioctl, _fn, _struct, _last, _type)                           \
16cec0d265219f Pasha Tatashin          2025-11-25  328          
[_IOC_NR(_ioctl) - LIVEUPDATE_CMD_SESSION_BASE] = {                    \
16cec0d265219f Pasha Tatashin          2025-11-25  329                  .size = 
sizeof(_struct) +                                      \
16cec0d265219f Pasha Tatashin          2025-11-25  330                          
BUILD_BUG_ON_ZERO(sizeof(union ucmd_buffer) <          \
16cec0d265219f Pasha Tatashin          2025-11-25  331                          
                  sizeof(_struct)),                    \
16cec0d265219f Pasha Tatashin          2025-11-25  332                  
.min_size = offsetofend(_struct, _last),                       \
16cec0d265219f Pasha Tatashin          2025-11-25  333                  
.ioctl_num = _ioctl,                                           \
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  334)                 .type = 
_type,                                                 \
16cec0d265219f Pasha Tatashin          2025-11-25  335                  
.execute = _fn,                                                \
16cec0d265219f Pasha Tatashin          2025-11-25  336          }
16cec0d265219f Pasha Tatashin          2025-11-25  337  
16cec0d265219f Pasha Tatashin          2025-11-25  338  static const struct 
luo_ioctl_op luo_session_ioctl_ops[] = {
16cec0d265219f Pasha Tatashin          2025-11-25  339          
IOCTL_OP(LIVEUPDATE_SESSION_FINISH, luo_session_finish,
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  340)                  struct 
liveupdate_session_finish, reserved, LUO_IOCTL_INCOMING),
16cec0d265219f Pasha Tatashin          2025-11-25  341          
IOCTL_OP(LIVEUPDATE_SESSION_PRESERVE_FD, luo_session_preserve_fd,
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  342)                  struct 
liveupdate_session_preserve_fd, token, LUO_IOCTL_OUTGOING),
16cec0d265219f Pasha Tatashin          2025-11-25 @343          
IOCTL_OP(LIVEUPDATE_SESSION_RETRIEVE_FD, luo_session_retrieve_fd,
16cec0d265219f Pasha Tatashin          2025-11-25 @344                   struct 
liveupdate_session_retrieve_fd, token),
4c08a9f38c50c0 Luca Boccassi           2026-04-29  345          
IOCTL_OP(LIVEUPDATE_SESSION_GET_NAME, luo_session_get_name,
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  346)                  struct 
liveupdate_session_retrieve_fd, token, LUO_IOCTL_INCOMING),
16cec0d265219f Pasha Tatashin          2025-11-25  347  };
16cec0d265219f Pasha Tatashin          2025-11-25  348  
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  349) static bool 
luo_ioctl_type_valid(struct luo_session *session,
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  350)                         
         const struct luo_ioctl_op *op)
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  351) {
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  352)         switch 
(op->type) {
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  353)         case 
LUO_IOCTL_INCOMING:
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  354)                 /* 
Retrieved is only set on incoming sessions */
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  355)                 return 
session->retrieved;
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  356)         case 
LUO_IOCTL_OUTGOING:
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  357)                 return 
!session->retrieved;
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  358)         case 
LUO_IOCTL_ALL:
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  359)                 return 
true;
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  360)         }
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  361) 
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  362)         /* Catch-all. */
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  363)         return false;
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  364) }
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  365) 
16cec0d265219f Pasha Tatashin          2025-11-25  366  static long 
luo_session_ioctl(struct file *filep, unsigned int cmd,
16cec0d265219f Pasha Tatashin          2025-11-25  367                          
      unsigned long arg)
16cec0d265219f Pasha Tatashin          2025-11-25  368  {
16cec0d265219f Pasha Tatashin          2025-11-25  369          struct 
luo_session *session = filep->private_data;
16cec0d265219f Pasha Tatashin          2025-11-25  370          const struct 
luo_ioctl_op *op;
16cec0d265219f Pasha Tatashin          2025-11-25  371          struct luo_ucmd 
ucmd = {};
16cec0d265219f Pasha Tatashin          2025-11-25  372          union 
ucmd_buffer buf;
16cec0d265219f Pasha Tatashin          2025-11-25  373          unsigned int nr;
16cec0d265219f Pasha Tatashin          2025-11-25  374          int ret;
16cec0d265219f Pasha Tatashin          2025-11-25  375  
16cec0d265219f Pasha Tatashin          2025-11-25  376          nr = 
_IOC_NR(cmd);
16cec0d265219f Pasha Tatashin          2025-11-25  377          if (nr < 
LIVEUPDATE_CMD_SESSION_BASE || (nr - LIVEUPDATE_CMD_SESSION_BASE) >=
16cec0d265219f Pasha Tatashin          2025-11-25 @378              
ARRAY_SIZE(luo_session_ioctl_ops)) {
16cec0d265219f Pasha Tatashin          2025-11-25  379                  return 
-EINVAL;
16cec0d265219f Pasha Tatashin          2025-11-25  380          }
16cec0d265219f Pasha Tatashin          2025-11-25  381  
16cec0d265219f Pasha Tatashin          2025-11-25  382          ucmd.ubuffer = 
(void __user *)arg;
16cec0d265219f Pasha Tatashin          2025-11-25  383          ret = 
get_user(ucmd.user_size, (u32 __user *)ucmd.ubuffer);
16cec0d265219f Pasha Tatashin          2025-11-25  384          if (ret)
16cec0d265219f Pasha Tatashin          2025-11-25  385                  return 
ret;
16cec0d265219f Pasha Tatashin          2025-11-25  386  
16cec0d265219f Pasha Tatashin          2025-11-25  387          op = 
&luo_session_ioctl_ops[nr - LIVEUPDATE_CMD_SESSION_BASE];
16cec0d265219f Pasha Tatashin          2025-11-25  388          if 
(op->ioctl_num != cmd)
16cec0d265219f Pasha Tatashin          2025-11-25  389                  return 
-ENOIOCTLCMD;
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  390)         if 
(!luo_ioctl_type_valid(session, op))
74cab0be9a5d9d Pratyush Yadav (Google  2026-05-19  391)                 return 
-EINVAL;
16cec0d265219f Pasha Tatashin          2025-11-25  392          if 
(ucmd.user_size < op->min_size)
16cec0d265219f Pasha Tatashin          2025-11-25  393                  return 
-EINVAL;
16cec0d265219f Pasha Tatashin          2025-11-25  394  
16cec0d265219f Pasha Tatashin          2025-11-25  395          ucmd.cmd = &buf;
16cec0d265219f Pasha Tatashin          2025-11-25  396          ret = 
copy_struct_from_user(ucmd.cmd, op->size, ucmd.ubuffer,
16cec0d265219f Pasha Tatashin          2025-11-25  397                          
            ucmd.user_size);
16cec0d265219f Pasha Tatashin          2025-11-25  398          if (ret)
16cec0d265219f Pasha Tatashin          2025-11-25  399                  return 
ret;
16cec0d265219f Pasha Tatashin          2025-11-25  400  
16cec0d265219f Pasha Tatashin          2025-11-25  401          return 
op->execute(session, &ucmd);
16cec0d265219f Pasha Tatashin          2025-11-25  402  }
16cec0d265219f Pasha Tatashin          2025-11-25  403  

:::::: The code at line 344 was first introduced by commit
:::::: 16cec0d265219f14a7fcebcc43aeb69205adba56 liveupdate: luo_session: add 
ioctls for file preservation

:::::: TO: Pasha Tatashin <[email protected]>
:::::: CC: Andrew Morton <[email protected]>

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

Reply via email to