[bug report] cifs: cache dirent names for cached directories

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

 



Hello Ronnie Sahlberg,

This is a semi-automatic email about new static checker warnings.

The patch 4cfa6d6563b6: "cifs: cache dirent names for cached
directories" from May 3, 2022, leads to the following Smatch
complaint:

    fs/cifs/smb2ops.c:796 open_cached_dir()
    warn: variable dereferenced before check 'tcon' (see line 780)

fs/cifs/smb2ops.c
   779	{
   780		struct cifs_ses *ses = tcon->ses;
                                       ^^^^^^^^^
Dereference

   781		struct TCP_Server_Info *server = ses->server;
   782		struct cifs_open_parms oparms;
   783		struct smb2_create_rsp *o_rsp = NULL;
   784		struct smb2_query_info_rsp *qi_rsp = NULL;
   785		int resp_buftype[2];
   786		struct smb_rqst rqst[2];
   787		struct kvec rsp_iov[2];
   788		struct kvec open_iov[SMB2_CREATE_IOV_SIZE];
   789		struct kvec qi_iov[1];
   790		int rc, flags = 0;
   791		__le16 utf16_path = 0; /* Null - since an open of top of share */
   792		u8 oplock = SMB2_OPLOCK_LEVEL_II;
   793		struct cifs_fid *pfid;
   794		struct dentry *dentry;
   795	
   796		if (tcon == NULL || tcon->nohandlecache ||
                    ^^^^^^^^^^^^
The patch adds a new NULL check, but too late.

   797		    is_smb1_server(tcon->ses->server))
   798			return -ENOTSUPP;

regards,
dan carpenter



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux