LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] fs/ntfs3: Remove unused variable cnt in ntfs_security_init()
@ 2021-08-16 19:30 Nathan Chancellor
  2021-08-16 21:56 ` Nick Desaulniers
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nathan Chancellor @ 2021-08-16 19:30 UTC (permalink / raw)
  To: Konstantin Komarov
  Cc: ntfs3, linux-kernel, clang-built-linux, Nathan Chancellor

Clang warns:

fs/ntfs3/fsntfs.c:1874:9: warning: variable 'cnt' set but not used
[-Wunused-but-set-variable]
        size_t cnt, off;
               ^
1 warning generated.

It is indeed unused so remove it.

Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 fs/ntfs3/fsntfs.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
index 92140050fb6c..c6599c514acf 100644
--- a/fs/ntfs3/fsntfs.c
+++ b/fs/ntfs3/fsntfs.c
@@ -1871,7 +1871,7 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
 	struct ATTRIB *attr;
 	struct ATTR_LIST_ENTRY *le;
 	u64 sds_size;
-	size_t cnt, off;
+	size_t off;
 	struct NTFS_DE *ne;
 	struct NTFS_DE_SII *sii_e;
 	struct ntfs_fnd *fnd_sii = NULL;
@@ -1946,7 +1946,6 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
 	sbi->security.next_off =
 		Quad2Align(sds_size - SecurityDescriptorsBlockSize);
 
-	cnt = 0;
 	off = 0;
 	ne = NULL;
 
@@ -1964,8 +1963,6 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
 		next_id = le32_to_cpu(sii_e->sec_id) + 1;
 		if (next_id >= sbi->security.next_id)
 			sbi->security.next_id = next_id;
-
-		cnt += 1;
 	}
 
 	sbi->security.ni = ni;

base-commit: 96b18047a7172037ff4206720f4e889670030b41
-- 
2.33.0.rc2


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

* Re: [PATCH] fs/ntfs3: Remove unused variable cnt in ntfs_security_init()
  2021-08-16 19:30 [PATCH] fs/ntfs3: Remove unused variable cnt in ntfs_security_init() Nathan Chancellor
@ 2021-08-16 21:56 ` Nick Desaulniers
  2021-08-16 23:36 ` Kari Argillander
  2021-08-27 16:12 ` Konstantin Komarov
  2 siblings, 0 replies; 4+ messages in thread
From: Nick Desaulniers @ 2021-08-16 21:56 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Konstantin Komarov, ntfs3, linux-kernel, clang-built-linux

On Mon, Aug 16, 2021 at 12:30 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Clang warns:
>
> fs/ntfs3/fsntfs.c:1874:9: warning: variable 'cnt' set but not used
> [-Wunused-but-set-variable]
>         size_t cnt, off;
>                ^
> 1 warning generated.
>
> It is indeed unused so remove it.
>
> Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")

I went back to the original patches to see if this was ever used;
since v2 (when the ntfs3 driver was split up) it was not. I triple
checked the v1 as well.
v2: https://lore.kernel.org/lkml/caddbe41eaef4622aab8bac24934eed1@paragon-software.com/
v1: https://dl.paragon-software.com/ntfs3/ntfs3.patch
I don't think there's a logic error here.

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  fs/ntfs3/fsntfs.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
> index 92140050fb6c..c6599c514acf 100644
> --- a/fs/ntfs3/fsntfs.c
> +++ b/fs/ntfs3/fsntfs.c
> @@ -1871,7 +1871,7 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
>         struct ATTRIB *attr;
>         struct ATTR_LIST_ENTRY *le;
>         u64 sds_size;
> -       size_t cnt, off;
> +       size_t off;
>         struct NTFS_DE *ne;
>         struct NTFS_DE_SII *sii_e;
>         struct ntfs_fnd *fnd_sii = NULL;
> @@ -1946,7 +1946,6 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
>         sbi->security.next_off =
>                 Quad2Align(sds_size - SecurityDescriptorsBlockSize);
>
> -       cnt = 0;
>         off = 0;
>         ne = NULL;
>
> @@ -1964,8 +1963,6 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
>                 next_id = le32_to_cpu(sii_e->sec_id) + 1;
>                 if (next_id >= sbi->security.next_id)
>                         sbi->security.next_id = next_id;
> -
> -               cnt += 1;
>         }
>
>         sbi->security.ni = ni;
>
> base-commit: 96b18047a7172037ff4206720f4e889670030b41
> --
> 2.33.0.rc2
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210816193041.1164125-1-nathan%40kernel.org.



-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] fs/ntfs3: Remove unused variable cnt in ntfs_security_init()
  2021-08-16 19:30 [PATCH] fs/ntfs3: Remove unused variable cnt in ntfs_security_init() Nathan Chancellor
  2021-08-16 21:56 ` Nick Desaulniers
@ 2021-08-16 23:36 ` Kari Argillander
  2021-08-27 16:12 ` Konstantin Komarov
  2 siblings, 0 replies; 4+ messages in thread
From: Kari Argillander @ 2021-08-16 23:36 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Konstantin Komarov, Nick Desaulniers, ntfs3, linux-kernel,
	clang-built-linux

On Mon, Aug 16, 2021 at 12:30:41PM -0700, Nathan Chancellor wrote:
> Clang warns:
> 
> fs/ntfs3/fsntfs.c:1874:9: warning: variable 'cnt' set but not used
> [-Wunused-but-set-variable]
>         size_t cnt, off;
>                ^
> 1 warning generated.
> 
> It is indeed unused so remove it.
> 
> Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Looks like it was used for debugging or way before index_find_raw()
needed hint or something. So this should be ok.

Reviewed-by: Kari Argillander <kari.argillander@gmail.com>

> ---
>  fs/ntfs3/fsntfs.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
> index 92140050fb6c..c6599c514acf 100644
> --- a/fs/ntfs3/fsntfs.c
> +++ b/fs/ntfs3/fsntfs.c
> @@ -1871,7 +1871,7 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
>  	struct ATTRIB *attr;
>  	struct ATTR_LIST_ENTRY *le;
>  	u64 sds_size;
> -	size_t cnt, off;
> +	size_t off;
>  	struct NTFS_DE *ne;
>  	struct NTFS_DE_SII *sii_e;
>  	struct ntfs_fnd *fnd_sii = NULL;
> @@ -1946,7 +1946,6 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
>  	sbi->security.next_off =
>  		Quad2Align(sds_size - SecurityDescriptorsBlockSize);
>  
> -	cnt = 0;
>  	off = 0;
>  	ne = NULL;
>  
> @@ -1964,8 +1963,6 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
>  		next_id = le32_to_cpu(sii_e->sec_id) + 1;
>  		if (next_id >= sbi->security.next_id)
>  			sbi->security.next_id = next_id;
> -
> -		cnt += 1;
>  	}
>  
>  	sbi->security.ni = ni;
> 
> base-commit: 96b18047a7172037ff4206720f4e889670030b41
> -- 
> 2.33.0.rc2
> 
> 

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

* RE: [PATCH] fs/ntfs3: Remove unused variable cnt in ntfs_security_init()
  2021-08-16 19:30 [PATCH] fs/ntfs3: Remove unused variable cnt in ntfs_security_init() Nathan Chancellor
  2021-08-16 21:56 ` Nick Desaulniers
  2021-08-16 23:36 ` Kari Argillander
@ 2021-08-27 16:12 ` Konstantin Komarov
  2 siblings, 0 replies; 4+ messages in thread
From: Konstantin Komarov @ 2021-08-27 16:12 UTC (permalink / raw)
  To: Nathan Chancellor; +Cc: ntfs3, linux-kernel, clang-built-linux

> From: Nathan Chancellor <nathan@kernel.org>
> Sent: Monday, August 16, 2021 10:31 PM
> To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
> Cc: ntfs3@lists.linux.dev; linux-kernel@vger.kernel.org; clang-built-linux@googlegroups.com; Nathan Chancellor
> <nathan@kernel.org>
> Subject: [PATCH] fs/ntfs3: Remove unused variable cnt in ntfs_security_init()
> 
> Clang warns:
> 
> fs/ntfs3/fsntfs.c:1874:9: warning: variable 'cnt' set but not used
> [-Wunused-but-set-variable]
>         size_t cnt, off;
>                ^
> 1 warning generated.
> 
> It is indeed unused so remove it.
> 
> Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  fs/ntfs3/fsntfs.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
> index 92140050fb6c..c6599c514acf 100644
> --- a/fs/ntfs3/fsntfs.c
> +++ b/fs/ntfs3/fsntfs.c
> @@ -1871,7 +1871,7 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
>  	struct ATTRIB *attr;
>  	struct ATTR_LIST_ENTRY *le;
>  	u64 sds_size;
> -	size_t cnt, off;
> +	size_t off;
>  	struct NTFS_DE *ne;
>  	struct NTFS_DE_SII *sii_e;
>  	struct ntfs_fnd *fnd_sii = NULL;
> @@ -1946,7 +1946,6 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
>  	sbi->security.next_off =
>  		Quad2Align(sds_size - SecurityDescriptorsBlockSize);
> 
> -	cnt = 0;
>  	off = 0;
>  	ne = NULL;
> 
> @@ -1964,8 +1963,6 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
>  		next_id = le32_to_cpu(sii_e->sec_id) + 1;
>  		if (next_id >= sbi->security.next_id)
>  			sbi->security.next_id = next_id;
> -
> -		cnt += 1;
>  	}
> 
>  	sbi->security.ni = ni;
> 
> base-commit: 96b18047a7172037ff4206720f4e889670030b41
> --
> 2.33.0.rc2

Hi Nathan! Thanks for your contribution - applied.

Best regards.

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

end of thread, other threads:[~2021-08-27 16:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16 19:30 [PATCH] fs/ntfs3: Remove unused variable cnt in ntfs_security_init() Nathan Chancellor
2021-08-16 21:56 ` Nick Desaulniers
2021-08-16 23:36 ` Kari Argillander
2021-08-27 16:12 ` Konstantin Komarov

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).