Skip to contentSkip to conversation

xfsprogs: remove unreachable code in libxfs_inode_alloc

PATCH In review Eric Sandeen 2 participants 2 messages Apr 6, 2015 – Apr 7, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfsprogs: remove unreachable code in libxfs_inode_alloc

This code does:

        if (!ialloc_context && !ip)
                return;

        // if !ip here, ialloc_context must be true

        if (ialloc_context) {
                ...
                if (!ip)
                        error = ENOSPC;
                if (error)
                        return error;
                // if !ip in this block we've returned
        }

        // so (!ip) cannot be true here
        if (!ip)
                error = ENOSPC;

(cherry picked this one out of Coverity reports)

---

libxfs/util.c +0 -2
index 6464a1b..49eb76d 100644
@@ -700,8 +700,6 @@ libxfs_inode_alloc(
 		if (error)
 			return error;
 	}
-	if (!ip)
-		error = ENOSPC;
 
 	*ipp = ip;
 	return error;

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Eric Sandeen

This code does:

        if (!ialloc_context && !ip)
                return;

        // if !ip here, ialloc_context must be true

        if (ialloc_context) {
                ...
                if (!ip)
                        error = ENOSPC;
                if (error)
                        return error;
                // if !ip in this block we've returned
        }

        // so (!ip) cannot be true here
        if (!ip)
                error = ENOSPC;
Quoted 4 lines

(cherry picked this one out of Coverity reports)

---

Quoted 15 lines
libxfs/util.c +0 -2
index 6464a1b..49eb76d 100644
@@ -700,8 +700,6 @@ libxfs_inode_alloc(
 		if (error)
 			return error;
 	}
-	if (!ip)
-		error = ENOSPC;
 
 	*ipp = ip;
 	return error;
Quoted 4 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs