diff options
author | Markus Elfring <Markus.Elfring@web.de> | 2023-04-13 20:54:30 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2023-04-18 14:58:32 +0200 |
commit | 55534c094fd4e47db5547a013feab3ee88576e73 (patch) | |
tree | bd82a4ce57188450732d74360e30bf448984f320 | |
parent | 130cf5269cd267a9bf179017666f454d82bc13ef (diff) |
gfs2: Move variable assignment behind a null pointer check in inode_go_dump
Since commit 27a2660f1ef9 ("gfs2: Dump nrpages for inodes and their
glocks"), inode_go_dump() computes the address of inode within ip before
checking if ip is NULL. This isn't a bug by itself, but it can give
rise to bugs later. Avoid that by checking if ip is NULL first.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
-rw-r--r-- | fs/gfs2/glops.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index b65950e76be5..6e33c8058059 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c @@ -535,12 +535,13 @@ static void inode_go_dump(struct seq_file *seq, struct gfs2_glock *gl, const char *fs_id_buf) { struct gfs2_inode *ip = gl->gl_object; - struct inode *inode = &ip->i_inode; + struct inode *inode; unsigned long nrpages; if (ip == NULL) return; + inode = &ip->i_inode; xa_lock_irq(&inode->i_data.i_pages); nrpages = inode->i_data.nrpages; xa_unlock_irq(&inode->i_data.i_pages); |