Skip to contentSkip to conversation

fat: correct ATTR_VFAT check

PATCH New Sergei Shtylyov 2 participants 2 messages Oct 19, 2011 – Oct 27, 2011 VFAT/FAT/msdos filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fat: correct ATTR_VFAT check

From: J. Vijayanand <[email protected]>

ATTR_VFAT condition requires multiple bits to be set but the present condition checking in do_fat_read() & get_dentfromdir() ends up passing on even a single bit being set.

---
 fs/fat/fat.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/fat/fat.c +3 -3
Index: u-boot/fs/fat/fat.c
===================================================================
@@ -572,8 +572,8 @@ static dir_entry *get_dentfromdir (fsdat
 			}
 			if ((dentptr->attr & ATTR_VOLUME)) {
 #ifdef CONFIG_SUPPORT_VFAT
-				if ((dentptr->attr & ATTR_VFAT) &&
-				    (dentptr-> name[0] & LAST_LONG_ENTRY_MASK)) {
+				if ((dentptr->attr & ATTR_VFAT) == ATTR_VFAT &&
+				    (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
 					prevcksum = ((dir_slot *)dentptr)->alias_checksum;
 					get_vfatname(mydata, curclust,
 						     get_dentfromdir_block,
@@ -897,7 +897,7 @@ do_fat_read (const char *filename, void 
 			}
 			if ((dentptr->attr & ATTR_VOLUME)) {
 #ifdef CONFIG_SUPPORT_VFAT
-				if ((dentptr->attr & ATTR_VFAT) &&
+				if ((dentptr->attr & ATTR_VFAT) == ATTR_VFAT &&
 				    (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
 					prevcksum =
 						((dir_slot *)dentptr)->alias_checksum;
#1 lore raw

PATCH 1/1 fat: correct ATTR_VFAT check

Dear Sergei Shtylyov,

Quoted 6 lines · In message <[email protected]> you wrote:

From: J. Vijayanand <[email protected]>

ATTR_VFAT condition requires multiple bits to be set but the present condition checking in do_fat_read() & get_dentfromdir() ends up passing on even a single bit being set.

Quoted 6 lines
---
 fs/fat/fat.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Defaults are wonderful, just like fire.
                  - Larry Wall in <[email protected]>