smatch warn: fs/smb/client/file.c:4910 cifs_oplock_break() warn: variable dereferenced before check 'inode' (see line 4881) If 'inode' is NULL, print some warning and return. Signed-off-by: Su Hui <suhui@xxxxxxxxxxxx> --- fs/smb/client/file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index 2108b3b40ce9..37eed057ded0 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -4878,6 +4878,12 @@ void cifs_oplock_break(struct work_struct *work) struct cifsFileInfo *cfile = container_of(work, struct cifsFileInfo, oplock_break); struct inode *inode = d_inode(cfile->dentry); + + if (!inode) { + cifs_dbg(FYI, "%s : failed to find inode\n", __func__); + return; + } + struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifsInodeInfo *cinode = CIFS_I(inode); struct cifs_tcon *tcon; @@ -4907,7 +4913,7 @@ void cifs_oplock_break(struct work_struct *work) cinode->oplock = 0; } - if (inode && S_ISREG(inode->i_mode)) { + if (S_ISREG(inode->i_mode)) { if (CIFS_CACHE_READ(cinode)) break_lease(inode, O_RDONLY); else -- 2.30.2