Skip to contentSkip to conversation

exfat: clear filename field before setting initial name

PATCH In review Hyeongseok.Kim 3 participants 7 messages Jun 9, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exfat: clear filename field before setting initial name

Some fsck tool complain that padding part of the FileName Field is not set to the value 0000h. So let's follow the filesystem spec.

---
 fs/exfat/dir.c | 3 +++
 1 file changed, 3 insertions(+)
fs/exfat/dir.c +3 -0
index de43534..6c9810b 100644
@@ -424,6 +424,9 @@ static void exfat_init_name_entry(struct exfat_dentry *ep,
 	exfat_set_entry_type(ep, TYPE_EXTEND);
 	ep->dentry.name.flags = 0x0;
 
+	memset(ep->dentry.name.unicode_0_14, 0,
+		sizeof(ep->dentry.name.unicode_0_14));
+
 	for (i = 0; i < EXFAT_FILE_NAME_LEN; i++) {
 		ep->dentry.name.unicode_0_14[i] = cpu_to_le16(*uniname);
 		if (*uniname == 0x0)
Signature · 1 line
2.7.4
#1 lore raw

Hi Hyeongseok,

Quoted 12 lines

Some fsck tool complain that padding part of the FileName Field is not set to the value 0000h. So let's follow the filesystem spec.

---
 fs/exfat/dir.c | 3 +++
 1 file changed, 3 insertions(+)

fs/exfat/dir.c static void exfat_init_name_entry(struct exfat_dentry *ep, · line 432

Quoted 9 lines
fs/exfat/dir.c +3 -0
@@ -424,6 +424,9 @@ static void exfat_init_name_entry(struct exfat_dentry *ep,
 	exfat_set_entry_type(ep, TYPE_EXTEND);
 	ep->dentry.name.flags = 0x0;
 
+	memset(ep->dentry.name.unicode_0_14, 0,
+		sizeof(ep->dentry.name.unicode_0_14));
+
 	for (i = 0; i < EXFAT_FILE_NAME_LEN; i++) {
 		ep->dentry.name.unicode_0_14[i] = cpu_to_le16(*uniname);
 		if (*uniname == 0x0)

Wouldn't it be better to fill the rest with 0x0000 in this loop?

Quoted 2 lines

--
2.7.4

author
#2 lore raw
Quoted 17 lines · Namjae Jeon

Hi Hyeongseok,

Quoted 15 lines

Some fsck tool complain that padding part of the FileName Field is not set to the value 0000h. So let's follow the filesystem spec.

---
  fs/exfat/dir.c | 3 +++
  1 file changed, 3 insertions(+)
fs/exfat/dir.c +0 -0
@@ -424,6 +424,9 @@ static void exfat_init_name_entry(struct exfat_dentry *ep,
  	exfat_set_entry_type(ep, TYPE_EXTEND);
  	ep->dentry.name.flags = 0x0;
 
Quoted 7 lines

fs/exfat/dir.c static void exfat_init_name_entry(struct exfat_dentry *ep, · line 432

Quoted 6 lines
fs/exfat/dir.c +3 -0
+	memset(ep->dentry.name.unicode_0_14, 0,
+		sizeof(ep->dentry.name.unicode_0_14));
+
  	for (i = 0; i < EXFAT_FILE_NAME_LEN; i++) {
  		ep->dentry.name.unicode_0_14[i] = cpu_to_le16(*uniname);
  		if (*uniname == 0x0)

Wouldn't it be better to fill the rest with 0x0000 in this loop?

OK, I'll change like that.

Quoted 5 lines
Quoted 2 lines

--
2.7.4

.

maintainer
#3 lore raw
In reply to Hyeongseok.Kim
Quoted 2 lines

Some fsck tool complain that padding part of the FileName Field is not set to the value 0000h. So let's follow the filesystem spec.

As I know, it's specified as not "shall" but "should". That is, it is not a mandatory for compatibility. Have you checked it on Windows?

Quoted 22 lines
---
 fs/exfat/dir.c | 3 +++
 1 file changed, 3 insertions(+)
fs/exfat/dir.c +3 -0
@@ -424,6 +424,9 @@ static void exfat_init_name_entry(struct exfat_dentry
 *ep,
 	exfat_set_entry_type(ep, TYPE_EXTEND);
 	ep->dentry.name.flags = 0x0;
 
+	memset(ep->dentry.name.unicode_0_14, 0,
+		sizeof(ep->dentry.name.unicode_0_14));
+
 	for (i = 0; i < EXFAT_FILE_NAME_LEN; i++) {
 		ep->dentry.name.unicode_0_14[i] = cpu_to_le16(*uniname);

if (*uniname == 0x0)
--
2.7.4

author
#4 lore raw
Quoted 5 lines · Sungjong Seo
Quoted 2 lines

Some fsck tool complain that padding part of the FileName Field is not set to the value 0000h. So let's follow the filesystem spec.

As I know, it's specified as not "shall" but "should". That is, it is not a mandatory for compatibility. Have you checked it on Windows?

Right, it's not mandatory and only some fsck'er do complain for this. But, there's no benefit by leaving the garbage bytes in the filename entry. Isn't it? Or, are you saying about the commit message?

Quoted 23 lines
Quoted 21 lines
---
  fs/exfat/dir.c | 3 +++
  1 file changed, 3 insertions(+)
fs/exfat/dir.c +3 -0
@@ -424,6 +424,9 @@ static void exfat_init_name_entry(struct exfat_dentry
 *ep,
  	exfat_set_entry_type(ep, TYPE_EXTEND);
  	ep->dentry.name.flags = 0x0;
 
+	memset(ep->dentry.name.unicode_0_14, 0,
+		sizeof(ep->dentry.name.unicode_0_14));
+
  	for (i = 0; i < EXFAT_FILE_NAME_LEN; i++) {
  		ep->dentry.name.unicode_0_14[i] = cpu_to_le16(*uniname);

if (*uniname == 0x0)
--
2.7.4

maintainer
#5 lore raw
Quoted 10 lines · Sungjong Seo
Quoted 5 lines
Quoted 2 lines

Some fsck tool complain that padding part of the FileName Field is not set to the value 0000h. So let's follow the filesystem spec.

As I know, it's specified as not "shall" but "should". That is, it is not a mandatory for compatibility. Have you checked it on Windows?

Right, it's not mandatory and only some fsck'er do complain for this. But, there's no benefit by leaving the garbage bytes in the filename entry. Isn't it?
Or, are you saying about the commit message?

The latter, I'm just saying this is not a spec-violation :)

Quoted 24 lines
Quoted 24 lines
Quoted 22 lines
---
  fs/exfat/dir.c | 3 +++
  1 file changed, 3 insertions(+)
fs/exfat/dir.c index de43534..6c9810b renamed from fs/exfat/dir.c +0 -0

100644

fs/exfat/dir.c +3 -0
@@ -424,6 +424,9 @@ static void exfat_init_name_entry(struct
 exfat_dentry *ep,
  	exfat_set_entry_type(ep, TYPE_EXTEND);
  	ep->dentry.name.flags = 0x0;
 
+	memset(ep->dentry.name.unicode_0_14, 0,
+		sizeof(ep->dentry.name.unicode_0_14));
+
  	for (i = 0; i < EXFAT_FILE_NAME_LEN; i++) {
  		ep->dentry.name.unicode_0_14[i] = cpu_to_le16(*uniname);

if (*uniname == 0x0)
--
2.7.4

author
#6 lore raw
Quoted 11 lines · Sungjong Seo
Quoted 10 lines · Sungjong Seo
Quoted 5 lines
Quoted 2 lines

Some fsck tool complain that padding part of the FileName Field is not set to the value 0000h. So let's follow the filesystem spec.

As I know, it's specified as not "shall" but "should". That is, it is not a mandatory for compatibility. Have you checked it on Windows?

Right, it's not mandatory and only some fsck'er do complain for this. But, there's no benefit by leaving the garbage bytes in the filename entry. Isn't it?
Or, are you saying about the commit message?

The latter, I'm just saying this is not a spec-violation :)

Yes, I got it.
Thanks.

Quoted 25 lines
Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
---
   fs/exfat/dir.c | 3 +++
   1 file changed, 3 insertions(+)
fs/exfat/dir.c index de43534..6c9810b renamed from fs/exfat/dir.c +0 -0

100644

fs/exfat/dir.c +3 -0
@@ -424,6 +424,9 @@ static void exfat_init_name_entry(struct
 exfat_dentry *ep,
   	exfat_set_entry_type(ep, TYPE_EXTEND);
   	ep->dentry.name.flags = 0x0;
 
+	memset(ep->dentry.name.unicode_0_14, 0,
+		sizeof(ep->dentry.name.unicode_0_14));
+
   	for (i = 0; i < EXFAT_FILE_NAME_LEN; i++) {
   		ep->dentry.name.unicode_0_14[i] = cpu_to_le16(*uniname);
   		if (*uniname == 0x0)

--
2.7.4