linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: remove shadow variable in xfs_btree_lshift
@ 2019-12-18 22:24 Eric Sandeen
  2019-12-18 23:12 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2019-12-18 22:24 UTC (permalink / raw)
  To: linux-xfs

From: Eric Sandeen <sandeen@redhat.com>

Sparse warns about a shadow variable in this function after the
Fixed: commit added another int i; with larger scope.  It's safe
to remove the one with the smaller scope to fix this shadow,
although the shadow itself is harmless.

Fixes: 2c813ad66a72 ("xfs: support btrees with overlapping intervals for keys")
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index e2cc98931552..b22c7e928eb1 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -2389,8 +2389,6 @@ xfs_btree_lshift(
 	XFS_BTREE_STATS_ADD(cur, moves, rrecs - 1);
 	if (level > 0) {
 		/* It's a nonleaf. operate on keys and ptrs */
-		int			i;		/* loop index */
-
 		for (i = 0; i < rrecs; i++) {
 			error = xfs_btree_debug_check_ptr(cur, rpp, i + 1, level);
 			if (error)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs: remove shadow variable in xfs_btree_lshift
  2019-12-18 22:24 [PATCH] xfs: remove shadow variable in xfs_btree_lshift Eric Sandeen
@ 2019-12-18 23:12 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2019-12-18 23:12 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: linux-xfs

On Wed, Dec 18, 2019 at 04:24:48PM -0600, Eric Sandeen wrote:
> From: Eric Sandeen <sandeen@redhat.com>
> 
> Sparse warns about a shadow variable in this function after the
> Fixed: commit added another int i; with larger scope.  It's safe
> to remove the one with the smaller scope to fix this shadow,
> although the shadow itself is harmless.
> 
> Fixes: 2c813ad66a72 ("xfs: support btrees with overlapping intervals for keys")

Eesh that was a long time ago.

> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
> 
> diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
> index e2cc98931552..b22c7e928eb1 100644
> --- a/fs/xfs/libxfs/xfs_btree.c
> +++ b/fs/xfs/libxfs/xfs_btree.c
> @@ -2389,8 +2389,6 @@ xfs_btree_lshift(
>  	XFS_BTREE_STATS_ADD(cur, moves, rrecs - 1);
>  	if (level > 0) {
>  		/* It's a nonleaf. operate on keys and ptrs */
> -		int			i;		/* loop index */
> -
>  		for (i = 0; i < rrecs; i++) {
>  			error = xfs_btree_debug_check_ptr(cur, rpp, i + 1, level);
>  			if (error)
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-18 23:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 22:24 [PATCH] xfs: remove shadow variable in xfs_btree_lshift Eric Sandeen
2019-12-18 23:12 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).