• Jeff Layton's avatar
    cifs: dereferencing first then checking · d3892294
    Jeff Layton authored
    This patch is based on Dan's original patch. His original description is
    below:
    
    Smatch complained about a couple checking for NULL after dereferencing
    bugs.  I'm not super familiar with the code so I did the conservative
    thing and move the dereferences after the checks.
    
    The dereferences in cifs_lock() and cifs_fsync() were added in
    ba00ba64 "cifs: make various routines use the cifsFileInfo->tcon
    pointer".  The dereference in find_writable_file() was added in
    6508d904 "cifs: have find_readable/writable_file filter by fsuid".
    The comments there say it's possible to trigger the NULL dereference
    under stress.
    Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
    Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
    Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
    d3892294
file.c 60.4 KB