Skip to contentSkip to conversation

fs: ntfs3: fix Using uninitialized value n when calling indx_read

PATCH In review [email protected] 3 participants 4 messages Apr 18, 2022 – Jun 9, 2022 1 message not in the archive NTFS3 filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: ntfs3: fix Using uninitialized value n when calling indx_read

From: Yan Lei <[email protected]>

---
 fs/ntfs3/index.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/index.c +1 -1
index 6f81e3a49..76ebea253 100644
@@ -1994,7 +1994,7 @@ static int indx_free_children(struct ntfs_index *indx, struct ntfs_inode *ni,
 			      const struct NTFS_DE *e, bool trim)
 {
 	int err;
-	struct indx_node *n;
+	struct indx_node *n = NULL;
 	struct INDEX_HDR *hdr;
 	CLST vbn = de_get_vbn(e);
 	size_t i;
Signature · 1 line
2.30.0
#1 lore raw

This patch is sended from address [email protected] you need to send it from [email protected] this was probably mistake?

Also please write commit message. Always good to write how did you spot this and what message some analyzer showed to you. This way everyone else will can verify and maybe even learn to use new tools. This also looks like it really fix something so this needs fix tag so it can be easily back ported to stable.

Quoted 20 lines · On 10.4.2022 9.09, [email protected] wrote:

From: Yan Lei <[email protected]>

---
  fs/ntfs3/index.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/index.c +1 -1
index 6f81e3a49..76ebea253 100644
@@ -1994,7 +1994,7 @@ static int indx_free_children(struct ntfs_index *indx, struct ntfs_inode *ni,
  			      const struct NTFS_DE *e, bool trim)
  {
  	int err;
-	struct indx_node *n;
+	struct indx_node *n = NULL;
  	struct INDEX_HDR *hdr;
  	CLST vbn = de_get_vbn(e);
  	size_t i;

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Do not top post.

Quoted 3 lines · yan

   It's not a mistake, I can't send patchs with my company's email due
to some security issues。

Then patch cannot be accepted. If you tag patch with email which does not work how do people message to you if needed. Also how we can know that it is your email if you event can't use it. That company security policy goes too far if you can't even use your email address.

Quoted 9 lines

   The CWE bug were detected by a static code scanning tool called
CodeS of my company(I don't kown its real name).
   The CodeS reports:
   Use of an uninitialized variable(CWE-457)
   Using uninitialized value "n" when calling indx_read.

   commit messages is as below:
   This CWE bug were detected by a static code scanning tool, Fix using unitialized value n when calling indx_read

You need to send v2.

Quoted 29 lines
Quoted 25 lines · Kari Argillander

This patch is sended from address [email protected] you need to send it from [email protected] this was probably mistake?

Also please write commit message. Always good to write how did you spot this and what message some analyzer showed to you. This way everyone else will can verify and maybe even learn to use new tools. This also looks like it really fix something so this needs fix tag so it can be easily back ported to stable.

Quoted 20 lines · On 10.4.2022 9.09, [email protected] wrote:

From: Yan Lei <[email protected]>

---
  fs/ntfs3/index.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/index.c +1 -1
index 6f81e3a49..76ebea253 100644
@@ -1994,7 +1994,7 @@ static int indx_free_children(struct ntfs_index *indx, struct ntfs_inode *ni,
  			      const struct NTFS_DE *e, bool trim)
  {
  	int err;
-	struct indx_node *n;
+	struct indx_node *n = NULL;
  	struct INDEX_HDR *hdr;
  	CLST vbn = de_get_vbn(e);
  	size_t i;
#4 lore raw
In reply to a message not in the archive
Quoted 43 lines · yan

It's not a mistake, I can't send patchs with my company's email due to some security issues。

The CWE bug were detected by a static code scanning tool called CodeS of my company(I don't kown its real name). The CodeS reports:
Use of an uninitialized variable(CWE-457)
Using uninitialized value "n" when calling indx_read.

commit messages is as below:
This CWE bug were detected by a static code scanning tool, Fix using unitialized value n when calling indx_read

Quoted 17 lines · Kari Argillander

This patch is sended from address [email protected] you need to send it from [email protected] this was probably mistake?

Also please write commit message. Always good to write how did you spot this and what message some analyzer showed to you. This way everyone else will can verify and maybe even learn to use new tools. This also looks like it really fix something so this needs fix tag so it can be easily back ported to stable.

Quoted 7 lines · On 10.4.2022 9.09, [email protected] wrote:

From: Yan Lei <[email protected]>

---
   fs/ntfs3/index.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
fs/ntfs3/index.c +0 -0
index 6f81e3a49..76ebea253 100644
@@ -1994,7 +1994,7 @@ static int indx_free_children(struct ntfs_index *indx, struct ntfs_inode *ni,
Quoted 8 lines

fs/ntfs3/index.c static int indx_free_children(struct ntfs_index *indx, struct ntfs_inode *ni, · line 2000

Quoted 8 lines
fs/ntfs3/index.c +1 -1
   			      const struct NTFS_DE *e, bool trim)
   {
   	int err;
-	struct indx_node *n;
+	struct indx_node *n = NULL;
   	struct INDEX_HDR *hdr;
   	CLST vbn = de_get_vbn(e);
   	size_t i;

I've changed author email to [email protected] and applied patch. Thanks for catching this!