locks: new locks_mandatory_area calling convention
Hello Christoph Hellwig,
This is a semi-automatic email about new static checker warnings.
The patch 9e48b0c90a29: "locks: new locks_mandatory_area calling convention" from Dec 3, 2015, leads to the following Smatch complaint:
fs/locks.c:1250 locks_mandatory_area()
warn: variable dereferenced before check 'filp' (see line 1241)
fs/locks.c
1240 {
1241 struct inode *inode = file_inode(filp);
^^^^^^^^^^^^^^^^Patch adds new dereference inside the function call.
1242 struct file_lock fl;
1243 int error;
1244 bool sleep = false;
1245
1246 locks_init_lock(&fl);
1247 fl.fl_pid = current->tgid;
1248 fl.fl_file = filp;
1249 fl.fl_flags = FL_POSIX | FL_ACCESS;
1250 if (filp && !(filp->f_flags & O_NONBLOCK))
^^^^
Existing check is too late.
1251 sleep = true; 1252 fl.fl_type = type;
regards,
dan carpenter