Whamcloud - gitweb
LU-17000 coverity: Fix use before null under pcc.c 58/52658/3
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Thu, 12 Oct 2023 10:27:16 +0000 (06:27 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 25 Oct 2023 18:09:47 +0000 (18:09 +0000)
This patch fixes 'dereference before null' error reported
by coverity run.

CoverityID: 397538 ("Dereference before null"): pcc.c

Test-Parameters: trivial testlist=sanity-pcc
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: Ic125f74b61e500e2184bde894aade7119b7a2899
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52658
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/pcc.c

index ce6004d..9471e10 100644 (file)
@@ -2282,8 +2282,8 @@ int pcc_inode_create(struct super_block *sb, struct pcc_dataset *dataset,
 int pcc_inode_create_fini(struct inode *inode, struct pcc_create_attach *pca)
 {
        struct dentry *pcc_dentry = pca->pca_dentry;
-       struct pcc_super *super = ll_i2pccs(inode);
        const struct cred *old_cred;
+       struct pcc_super *super;
        struct pcc_inode *pcci;
        int rc;
 
@@ -2295,6 +2295,8 @@ int pcc_inode_create_fini(struct inode *inode, struct pcc_create_attach *pca)
        if (!inode)
                GOTO(out_dataset_put, rc = 0);
 
+       super = ll_i2pccs(inode);
+
        LASSERT(pcc_dentry);
 
        old_cred = override_creds(super->pccs_cred);