Skip to content

Commit 55534c0

Browse files
elfringAndreas Gruenbacher
authored andcommitted
gfs2: Move variable assignment behind a null pointer check in inode_go_dump
Since commit 27a2660 ("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 <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 130cf52 commit 55534c0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/gfs2/glops.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,12 +535,13 @@ static void inode_go_dump(struct seq_file *seq, struct gfs2_glock *gl,
535535
const char *fs_id_buf)
536536
{
537537
struct gfs2_inode *ip = gl->gl_object;
538-
struct inode *inode = &ip->i_inode;
538+
struct inode *inode;
539539
unsigned long nrpages;
540540

541541
if (ip == NULL)
542542
return;
543543

544+
inode = &ip->i_inode;
544545
xa_lock_irq(&inode->i_data.i_pages);
545546
nrpages = inode->i_data.nrpages;
546547
xa_unlock_irq(&inode->i_data.i_pages);

0 commit comments

Comments
 (0)