diff mbox

[U-Boot] fat: correct ATTR_VFAT check

Message ID 201110192143.08917.sshtylyov@ru.mvista.com
State Accepted
Commit 206d68fdd41e4942825cfc4a91a096297b654a24
Headers show

Commit Message

Sergei Shtylyov Oct. 19, 2011, 5:43 p.m. UTC
From: J. Vijayanand <vijayanand.jayaraman@in.bosch.com>

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.

Signed-off-by: J. Vijayanand <vijayanand.jayaraman@in.bosch.com>
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

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

Comments

Wolfgang Denk Oct. 27, 2011, 9:50 p.m. UTC | #1
Dear Sergei Shtylyov,

In message <201110192143.08917.sshtylyov@ru.mvista.com> you wrote:
> From: J. Vijayanand <vijayanand.jayaraman@in.bosch.com>
> 
> 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.
> 
> Signed-off-by: J. Vijayanand <vijayanand.jayaraman@in.bosch.com>
> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> 
> ---
>  fs/fat/fat.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
diff mbox

Patch

Index: u-boot/fs/fat/fat.c
===================================================================
--- u-boot.orig/fs/fat/fat.c
+++ 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;