fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
:::::: 
:::::: Manual check reason: "bisect to a FBC not belonging to original linux-review patches: branch: linux-review/ChenXiaoSong/smb-server-add-debug-type-for-change-notify/20260804-042542, commit: 49313fc18740a41a57f427351f2c72f6e59b0ecc"
:::::: 

BCC: [email protected]
CC: [email protected]
TO: ChenXiaoSong <[email protected]>
CC: 0day robot <[email protected]>

tree:   https://github.com/intel-lab-lkp/linux/commits/ChenXiaoSong/smb-server-add-debug-type-for-change-notify/20260804-042542
head:   e565b2925fa6dedcac7d1796a4b55d7ebf79db96
commit: 49313fc18740a41a57f427351f2c72f6e59b0ecc smb/server: validate notify requests
date:   20 hours ago
:::::: branch date: 20 hours ago
:::::: commit date: 20 hours ago
config: m68k-randconfig-r112-20260804 (https://download.01.org/0day-ci/archive/20260805/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 8.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260805/[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/r/[email protected]/

sparse warnings: (new ones prefixed by >>)
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64
>> fs/smb/server/notify.c:31:17: sparse: sparse: cast to restricted __le64

vim +31 fs/smb/server/notify.c

49313fc18740a4 ChenXiaoSong 2026-07-23  19  
49313fc18740a4 ChenXiaoSong 2026-07-23  20  static struct ksmbd_file *
49313fc18740a4 ChenXiaoSong 2026-07-23  21  ksmbd_notify_validate_req(struct ksmbd_work *work,
49313fc18740a4 ChenXiaoSong 2026-07-23  22  			  struct smb2_change_notify_req *req,
49313fc18740a4 ChenXiaoSong 2026-07-23  23  			  struct smb2_change_notify_rsp *rsp)
49313fc18740a4 ChenXiaoSong 2026-07-23  24  {
49313fc18740a4 ChenXiaoSong 2026-07-23  25  	struct ksmbd_file *fp;
49313fc18740a4 ChenXiaoSong 2026-07-23  26  	int err;
49313fc18740a4 ChenXiaoSong 2026-07-23  27  
49313fc18740a4 ChenXiaoSong 2026-07-23  28  	fp = ksmbd_lookup_fd_slow(work, req->VolatileFileId,
49313fc18740a4 ChenXiaoSong 2026-07-23  29  				  req->PersistentFileId);
49313fc18740a4 ChenXiaoSong 2026-07-23  30  	if (!fp) {
49313fc18740a4 ChenXiaoSong 2026-07-23 @31  		pr_err("Invalid file id for notify, fid %llu:%llu\n",
49313fc18740a4 ChenXiaoSong 2026-07-23  32  		       le64_to_cpu(req->PersistentFileId),
49313fc18740a4 ChenXiaoSong 2026-07-23  33  		       le64_to_cpu(req->VolatileFileId));
49313fc18740a4 ChenXiaoSong 2026-07-23  34  		rsp->hdr.Status = STATUS_FILE_CLOSED;
49313fc18740a4 ChenXiaoSong 2026-07-23  35  		return ERR_PTR(-ENOENT);
49313fc18740a4 ChenXiaoSong 2026-07-23  36  	}
49313fc18740a4 ChenXiaoSong 2026-07-23  37  
49313fc18740a4 ChenXiaoSong 2026-07-23  38  	ksmbd_debug(NOTIFY,
49313fc18740a4 ChenXiaoSong 2026-07-23  39  		    "fid %llu:%llu, handle notify request, filter 0x%x, flags 0x%x\n",
49313fc18740a4 ChenXiaoSong 2026-07-23  40  		    fp->persistent_id, fp->volatile_id,
49313fc18740a4 ChenXiaoSong 2026-07-23  41  		    le32_to_cpu(req->CompletionFilter), le16_to_cpu(req->Flags));
49313fc18740a4 ChenXiaoSong 2026-07-23  42  
49313fc18740a4 ChenXiaoSong 2026-07-23  43  	if (!S_ISDIR(file_inode(fp->filp)->i_mode)) {
49313fc18740a4 ChenXiaoSong 2026-07-23  44  		pr_err("Notify file id is not a directory, fid %llu:%llu\n",
49313fc18740a4 ChenXiaoSong 2026-07-23  45  		       fp->persistent_id, fp->volatile_id);
49313fc18740a4 ChenXiaoSong 2026-07-23  46  		rsp->hdr.Status = STATUS_NOT_A_DIRECTORY;
49313fc18740a4 ChenXiaoSong 2026-07-23  47  		err = -ENOTDIR;
49313fc18740a4 ChenXiaoSong 2026-07-23  48  		goto err_put_fp;
49313fc18740a4 ChenXiaoSong 2026-07-23  49  	}
49313fc18740a4 ChenXiaoSong 2026-07-23  50  
49313fc18740a4 ChenXiaoSong 2026-07-23  51  	if (!(fp->daccess & FILE_LIST_DIRECTORY_LE)) {
49313fc18740a4 ChenXiaoSong 2026-07-23  52  		pr_err("No permission to monitor directory, fid %llu:%llu\n",
49313fc18740a4 ChenXiaoSong 2026-07-23  53  		       fp->persistent_id, fp->volatile_id);
49313fc18740a4 ChenXiaoSong 2026-07-23  54  		rsp->hdr.Status = STATUS_ACCESS_DENIED;
49313fc18740a4 ChenXiaoSong 2026-07-23  55  		err = -EACCES;
49313fc18740a4 ChenXiaoSong 2026-07-23  56  		goto err_put_fp;
49313fc18740a4 ChenXiaoSong 2026-07-23  57  	}
49313fc18740a4 ChenXiaoSong 2026-07-23  58  
49313fc18740a4 ChenXiaoSong 2026-07-23  59  	if (le32_to_cpu(req->OutputBufferLength) >
49313fc18740a4 ChenXiaoSong 2026-07-23  60  	    work->conn->vals->max_trans_size) {
49313fc18740a4 ChenXiaoSong 2026-07-23  61  		pr_err("Notify output buffer length %u exceeds maximum %u\n",
49313fc18740a4 ChenXiaoSong 2026-07-23  62  		       le32_to_cpu(req->OutputBufferLength),
49313fc18740a4 ChenXiaoSong 2026-07-23  63  		       work->conn->vals->max_trans_size);
49313fc18740a4 ChenXiaoSong 2026-07-23  64  		rsp->hdr.Status = STATUS_INVALID_PARAMETER;
49313fc18740a4 ChenXiaoSong 2026-07-23  65  		err = -EINVAL;
49313fc18740a4 ChenXiaoSong 2026-07-23  66  		goto err_put_fp;
49313fc18740a4 ChenXiaoSong 2026-07-23  67  	}
49313fc18740a4 ChenXiaoSong 2026-07-23  68  
49313fc18740a4 ChenXiaoSong 2026-07-23  69  	return fp;
49313fc18740a4 ChenXiaoSong 2026-07-23  70  
49313fc18740a4 ChenXiaoSong 2026-07-23  71  err_put_fp:
49313fc18740a4 ChenXiaoSong 2026-07-23  72  	ksmbd_fd_put(work, fp);
49313fc18740a4 ChenXiaoSong 2026-07-23  73  	return ERR_PTR(err);
49313fc18740a4 ChenXiaoSong 2026-07-23  74  }
49313fc18740a4 ChenXiaoSong 2026-07-23  75  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.