From f46d3e6f529b7501eff884e41d47bc2a5ed1650d Mon Sep 17 00:00:00 2001 From: Arshad Hussain Date: Thu, 12 Oct 2023 06:27:16 -0400 Subject: [PATCH] LU-17000 coverity: Fix use before null under pcc.c 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 Change-Id: Ic125f74b61e500e2184bde894aade7119b7a2899 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52658 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Timothy Day Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/llite/pcc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lustre/llite/pcc.c b/lustre/llite/pcc.c index ce6004d..9471e10 100644 --- a/lustre/llite/pcc.c +++ b/lustre/llite/pcc.c @@ -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); -- 1.8.3.1