[PATCH 09/58] xfs: remove the name == NULL check from xfs_attr_args_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Source kernel commit: 79f2280b9bfd54aa37b3fa4a80b0037bd29b4f0e

All callers provide a valid name pointer, remove the redundant check.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>
Reviewed-by: Chandan Rajendra <chandanrlinux@xxxxxxxxx>
Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 db/attrset.c      | 8 ++++++++
 libxfs/xfs_attr.c | 4 ----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/db/attrset.c b/db/attrset.c
index 4360e5f7..d4b812e6 100644
--- a/db/attrset.c
+++ b/db/attrset.c
@@ -127,6 +127,10 @@ attr_set_f(
 	}
 
 	name = argv[optind];
+	if (!name) {
+		dbprintf(_("invalid name\n"));
+		return 0;
+	}
 
 	if (valuelen) {
 		value = (char *)memalign(getpagesize(), valuelen);
@@ -214,6 +218,10 @@ attr_remove_f(
 	}
 
 	name = argv[optind];
+	if (!name) {
+		dbprintf(_("invalid name\n"));
+		return 0;
+	}
 
 	if (libxfs_iget(mp, NULL, iocur_top->ino, 0, &ip,
 			&xfs_default_ifork_ops)) {
diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c
index 248f9e83..ee2225a3 100644
--- a/libxfs/xfs_attr.c
+++ b/libxfs/xfs_attr.c
@@ -65,10 +65,6 @@ xfs_attr_args_init(
 	size_t			namelen,
 	int			flags)
 {
-
-	if (!name)
-		return -EINVAL;
-
 	memset(args, 0, sizeof(*args));
 	args->geo = dp->i_mount->m_attr_geo;
 	args->whichfork = XFS_ATTR_FORK;
-- 
2.26.2




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux