ntfs3.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/ntfs3: Uninitialized variable bug in ntfs_d_compare()
@ 2022-10-14  9:40 Dan Carpenter
  2022-12-26 15:15 ` Konstantin Komarov
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-10-14  9:40 UTC (permalink / raw)
  To: Konstantin Komarov; +Cc: ntfs3, kernel-janitors

Smatch detected an uninitialized variable bug:

    fs/ntfs3/namei.c:487 ntfs_d_compare() error: uninitialized symbol 'uni1'

Fixes: a3a956c78efa ("fs/ntfs3: Add option "nocase"")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/ntfs3/namei.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
index 315763eb05ff..5d3a6ce3f05f 100644
--- a/fs/ntfs3/namei.c
+++ b/fs/ntfs3/namei.c
@@ -431,10 +431,8 @@ static int ntfs_d_compare(const struct dentry *dentry, unsigned int len1,
 
 	/* First try fast implementation. */
 	for (;;) {
-		if (!lm--) {
-			ret = len1 == len2 ? 0 : 1;
-			goto out;
-		}
+		if (!lm--)
+			return len1 == len2 ? 0 : 1;
 
 		if ((c1 = *n1++) == (c2 = *n2++))
 			continue;
@@ -442,10 +440,8 @@ static int ntfs_d_compare(const struct dentry *dentry, unsigned int len1,
 		if (c1 >= 0x80 || c2 >= 0x80)
 			break;
 
-		if (toupper(c1) != toupper(c2)) {
-			ret = 1;
-			goto out;
-		}
+		if (toupper(c1) != toupper(c2))
+			return 1;
 	}
 
 	/*
-- 
2.35.1


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

* Re: [PATCH] fs/ntfs3: Uninitialized variable bug in ntfs_d_compare()
  2022-10-14  9:40 [PATCH] fs/ntfs3: Uninitialized variable bug in ntfs_d_compare() Dan Carpenter
@ 2022-12-26 15:15 ` Konstantin Komarov
  0 siblings, 0 replies; 2+ messages in thread
From: Konstantin Komarov @ 2022-12-26 15:15 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: ntfs3, kernel-janitors

On 14.10.2022 13:40, Dan Carpenter wrote:
> Smatch detected an uninitialized variable bug:
>
>      fs/ntfs3/namei.c:487 ntfs_d_compare() error: uninitialized symbol 'uni1'
>
> Fixes: a3a956c78efa ("fs/ntfs3: Add option "nocase"")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>   fs/ntfs3/namei.c | 12 ++++--------
>   1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
> index 315763eb05ff..5d3a6ce3f05f 100644
> --- a/fs/ntfs3/namei.c
> +++ b/fs/ntfs3/namei.c
> @@ -431,10 +431,8 @@ static int ntfs_d_compare(const struct dentry *dentry, unsigned int len1,
>   
>   	/* First try fast implementation. */
>   	for (;;) {
> -		if (!lm--) {
> -			ret = len1 == len2 ? 0 : 1;
> -			goto out;
> -		}
> +		if (!lm--)
> +			return len1 == len2 ? 0 : 1;
>   
>   		if ((c1 = *n1++) == (c2 = *n2++))
>   			continue;
> @@ -442,10 +440,8 @@ static int ntfs_d_compare(const struct dentry *dentry, unsigned int len1,
>   		if (c1 >= 0x80 || c2 >= 0x80)
>   			break;
>   
> -		if (toupper(c1) != toupper(c2)) {
> -			ret = 1;
> -			goto out;
> -		}
> +		if (toupper(c1) != toupper(c2))
> +			return 1;
>   	}
>   
>   	/*

Thanks for work, this bug has already been fixed:

https://lore.kernel.org/ntfs3/20221004232359.285685-1-nathan@kernel.org/


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

end of thread, other threads:[~2022-12-26 15:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-14  9:40 [PATCH] fs/ntfs3: Uninitialized variable bug in ntfs_d_compare() Dan Carpenter
2022-12-26 15:15 ` 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).