All of lore.kernel.org
 help / color / mirror / Atom feed
From: Allison Collins <allison.henderson@oracle.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH 2/2] xfs: Fix compiler warning in xfs_attr_shortform_add
Date: Sat, 25 Jul 2020 16:01:02 -0700	[thread overview]
Message-ID: <20200725230102.22192-3-allison.henderson@oracle.com> (raw)
In-Reply-To: <20200725230102.22192-1-allison.henderson@oracle.com>

Fix compiler warning: variable 'error' set but not used in
xfs_attr_shortform_add

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Allison Collins <allison.henderson@oracle.com>
---
 fs/xfs/libxfs/xfs_attr.c      |  3 +--
 fs/xfs/libxfs/xfs_attr_leaf.c | 11 ++++++++---
 fs/xfs/libxfs/xfs_attr_leaf.h |  2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index 4ef0020..3428f8b 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -562,8 +562,7 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
 	if (!forkoff)
 		return -ENOSPC;
 
-	xfs_attr_shortform_add(args, forkoff);
-	return 0;
+	return xfs_attr_shortform_add(args, forkoff);
 }
 
 
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
index ad7b351..d0653bb 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.c
+++ b/fs/xfs/libxfs/xfs_attr_leaf.c
@@ -708,7 +708,7 @@ xfs_attr_sf_findname(
  * Add a name/value pair to the shortform attribute list.
  * Overflow from the inode has already been checked for.
  */
-void
+int
 xfs_attr_shortform_add(
 	struct xfs_da_args		*args,
 	int				forkoff)
@@ -730,7 +730,8 @@ xfs_attr_shortform_add(
 	ASSERT(ifp->if_flags & XFS_IFINLINE);
 	sf = (xfs_attr_shortform_t *)ifp->if_u1.if_data;
 	error = xfs_attr_sf_findname(args, &sfe, NULL);
-	ASSERT(error != -EEXIST);
+	if (error == -EEXIST)
+		return error;
 
 	offset = (char *)sfe - (char *)sf;
 	size = XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, args->valuelen);
@@ -748,6 +749,8 @@ xfs_attr_shortform_add(
 	xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA);
 
 	xfs_sbversion_add_attr2(mp, args->trans);
+
+	return 0;
 }
 
 /*
@@ -1151,7 +1154,9 @@ xfs_attr3_leaf_to_shortform(
 		nargs.valuelen = be16_to_cpu(name_loc->valuelen);
 		nargs.hashval = be32_to_cpu(entry->hashval);
 		nargs.attr_filter = entry->flags & XFS_ATTR_NSP_ONDISK_MASK;
-		xfs_attr_shortform_add(&nargs, forkoff);
+		error = xfs_attr_shortform_add(&nargs, forkoff);
+		if (error)
+			goto out;
 	}
 	error = 0;
 
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.h b/fs/xfs/libxfs/xfs_attr_leaf.h
index 9b1c59f..e0027bb 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.h
+++ b/fs/xfs/libxfs/xfs_attr_leaf.h
@@ -46,7 +46,7 @@ struct xfs_attr3_icleaf_hdr {
  * Internal routines when attribute fork size < XFS_LITINO(mp).
  */
 void	xfs_attr_shortform_create(struct xfs_da_args *args);
-void	xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
+int	xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
 int	xfs_attr_shortform_lookup(struct xfs_da_args *args);
 int	xfs_attr_shortform_getvalue(struct xfs_da_args *args);
 int	xfs_attr_shortform_to_leaf(struct xfs_da_args *args,
-- 
2.7.4


  parent reply	other threads:[~2020-07-25 23:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-25 23:01 [PATCH 0/2] xfs: Fix compiler warnings Allison Collins
2020-07-25 23:01 ` [PATCH 1/2] xfs: Fix compiler warning in xfs_attr_node_removename_setup Allison Collins
2020-07-25 23:01 ` Allison Collins [this message]
2020-07-26  6:48   ` [PATCH 2/2] xfs: Fix compiler warning in xfs_attr_shortform_add Eric Sandeen
2020-07-26 18:10     ` Allison Collins
2020-07-27  0:27       ` Eric Sandeen
2020-07-27  1:57         ` Allison Collins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200725230102.22192-3-allison.henderson@oracle.com \
    --to=allison.henderson@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.