Skip to contentSkip to conversation

cifsd: add file operations

bug report Dan Carpenter 1 participant 1 message Jul 7, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello Namjae Jeon,

The patch f44158485826: "cifsd: add file operations" from Mar 16, 2021, leads to the following static checker warning:

	fs/ksmbd/vfs_cache.c:661 ksmbd_file_table_flush()
	warn: was expecting a 64 bit value instead of '0'

fs/ksmbd/vfs_cache.c
653 int ksmbd_file_table_flush(struct ksmbd_work *work) 654 {

   655          struct ksmbd_file       *fp = NULL;
   656          unsigned int            id;
   657          int                     ret;

658
659 read_lock(&work->sess->file_table.lock);
660 idr_for_each_entry(work->sess->file_table.idr, fp, id) {
661 ret = ksmbd_vfs_fsync(work, fp->volatile_id, KSMBD_NO_FID);

TBH, I'm not sure what's triggering this warning, but ksmbd_vfs_fsync() takes a u64 and fp->volatile_id is a u32. The ksmbd_lookup_fd_slow() function takes a u32 so passing a u64 value seems like it would lead to a bug. And smb2_flush() passes a u64 so this seems buggy.

   662                  if (ret)
   663                          break;
   664          }
   665          read_unlock(&work->sess->file_table.lock);
   666          return ret;
   667  }

regards,
dan carpenter