Thread (4 messages) 4 messages, 4 authors, 2021-06-11

Re: [PATCH] xfs: perag may be null in xfs_imap()

From: Allison Henderson <hidden>
Date: 2021-06-11 00:57:21


On 6/10/21 3:37 PM, Dave Chinner wrote:
From: Dave Chinner <redacted>

Dan Carpenter's static checker reported:

The patch 7b13c5155182: "xfs: use perag for ialloc btree cursors"
from Jun 2, 2021, leads to the following Smatch complaint:

     fs/xfs/libxfs/xfs_ialloc.c:2403 xfs_imap()
     error: we previously assumed 'pag' could be null (see line 2294)

And it's right. Fix it.

Fixes: 7b13c5155182 ("xfs: use perag for ialloc btree cursors")
Reported-by: Dan Carpenter <redacted>
Signed-off-by: Dave Chinner <redacted>
Looks ok
Reviewed-by: Allison Henderson <redacted>
quoted hunk ↗ jump to hunk
---
  fs/xfs/libxfs/xfs_ialloc.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index 654a8d9681e1..57d9cb632983 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -2398,7 +2398,8 @@ xfs_imap(
  	}
  	error = 0;
  out_drop:
-	xfs_perag_put(pag);
+	if (pag)
+		xfs_perag_put(pag);
  	return error;
  }
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help