Patch to fix this warning attached. On Wed, May 25, 2022 at 8:20 AM Steve French <smfrench@xxxxxxxxx> wrote: > > > ---------- Forwarded message --------- > From: <scan-admin@xxxxxxxxxxxx> > Date: Wed, May 25, 2022, 07:40 > Subject: New Defects reported by Coverity Scan for linux-next weekly scan > To: <smfrench@xxxxxxxxx> > > > Hi, > > Please find the latest report on new defect(s) introduced to linux-next weekly scan, under component 'FS-CIFS', found with Coverity Scan. > > 1 new defect(s) introduced to linux-next weekly scan, under component 'FS-CIFS', found with Coverity Scan. > 8 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan. > > New defect(s) Reported-by: Coverity Scan > Showing 1 of 1 defect(s) > > > ** CID 1518030: Null pointer dereferences (REVERSE_INULL) > /fs/cifs/readdir.c: 1108 in cifs_readdir() > > > ________________________________________________________________________________________________________ > *** CID 1518030: Null pointer dereferences (REVERSE_INULL) > /fs/cifs/readdir.c: 1108 in cifs_readdir() > 1102 mutex_unlock(&cfid->dirents.de_mutex); > 1103 > 1104 /* Drop the cache while calling initiate_cifs_search and > 1105 * find_cifs_entry in case there will be reconnects during > 1106 * query_directory. > 1107 */ > >>> CID 1518030: Null pointer dereferences (REVERSE_INULL) > >>> Null-checking "cfid" suggests that it may be null, but it has already been dereferenced on all paths leading to the check. > 1108 if (cfid) { > 1109 close_cached_dir(cfid); > 1110 cfid = NULL; > 1111 } > 1112 > 1113 cache_not_found: > > > ________________________________________________________________________________________________________ > To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50ypWUaxuG23arlAOMqBtlZty8jbpwvvNgxXk-2FmAsxmR9vW5nmNrMx1IpP6MDN1J2o1ZPwtxoZUPo2TKCoVE0eHSfAENI_Y7VRim-2Fxl9fmAdBRyG05vGZHoQCljkdhUYA-2FoqqLzdRcgL8NozXbXPTeip3E1wASk61xAAnRXanfXB8LqcT-2FwRhZs3l5M6RJV5-2B2zB6Y0j8JQfWKe27e73bfQ89ydmxnVAo-2FNvbBaX8QEbpzR4h82JcBlVZ25OTy33cLsYDIu1bdssbL-2FRwadbu9lLJN4dI1rPIaINt6Tz-2FUs9gVfquk6Q-3D-3D > > To manage Coverity Scan email notifications for "smfrench@xxxxxxxxx", click https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50yped04pjJnmXOsUBtKYNIXxgDITOxfLjGd57Ifg09SfMSZeD9rHMtRaJqZq0ctXqp7fRP-2BE8DxRp97FczN2h9FJkLzTHr7qddqCt-2F0SoddBt8k3Bc5cgjF9mAUP8Y7F8MA-3DZijn_Y7VRim-2Fxl9fmAdBRyG05vGZHoQCljkdhUYA-2FoqqLzdRcgL8NozXbXPTeip3E1wASSXlY5Xi8QRgougxC7RmAR-2BgidemDBxQLu-2F-2FOpS2Zh8OHdzNbXM7fgjsc7G7CXW79mTq7LOgCUGW9AsSS2aHeMTf2wbRpkyvZyfZqM9bb3M7WbRjhjgXOfau8yW2ZBZRWbJ33EaXk-2FdabyWYlOoI-2B0Q-3D-3D > -- Thanks, Steve
From ff172e41dffbd7c319df593e8c87ec816623c96e Mon Sep 17 00:00:00 2001 From: Steve French <stfrench@xxxxxxxxxxxxx> Date: Wed, 25 May 2022 23:56:07 -0500 Subject: [PATCH] smb3: remove unneeded null check in cifs_readdir Coverity pointed out an unneeded check. Addresses-Coverity: 1518030 ("Null pointer dereferences") Cc: Ronnie Sahlberg <lsahlber@xxxxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> --- fs/cifs/readdir.c | 6 ++---- fs/cifs/smb2ops.c | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index ccf34481d801..384cabdf47ca 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c @@ -1105,10 +1105,8 @@ int cifs_readdir(struct file *file, struct dir_context *ctx) * find_cifs_entry in case there will be reconnects during * query_directory. */ - if (cfid) { - close_cached_dir(cfid); - cfid = NULL; - } + close_cached_dir(cfid); + cfid = NULL; cache_not_found: /* diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 057d3f32cf8f..bc90f0bc1475 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -770,6 +770,7 @@ smb2_cached_lease_break(struct work_struct *work) /* * Open the and cache a directory handle. * Only supported for the root handle. + * If error then *cfid is not initialized. */ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon, const char *path, -- 2.34.1