From patchwork Wed Oct 19 17:43:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 120677 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id AE051B71D1 for ; Thu, 20 Oct 2011 04:44:46 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 55B8128BD1; Wed, 19 Oct 2011 19:44:44 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Vkv+5UFPJl6C; Wed, 19 Oct 2011 19:44:43 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DADBA28AAB; Wed, 19 Oct 2011 19:44:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0607D28AAB for ; Wed, 19 Oct 2011 19:44:39 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gVWGafixGXTe for ; Wed, 19 Oct 2011 19:44:37 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail.dev.rtsoft.ru (mail.dev.rtsoft.ru [213.79.90.226]) by theia.denx.de (Postfix) with SMTP id 0F68B28AA5 for ; Wed, 19 Oct 2011 19:44:35 +0200 (CEST) Received: (qmail 11237 invoked from network); 19 Oct 2011 17:44:34 -0000 Received: from unknown (HELO wasted.dev.rtsoft.ru) (192.168.1.70) by 0 with SMTP; 19 Oct 2011 17:44:34 -0000 To: u-boot@lists.denx.de Content-Disposition: inline From: Sergei Shtylyov Organization: MontaVista Software Inc. Date: Wed, 19 Oct 2011 21:43:08 +0400 MIME-Version: 1.0 Message-Id: <201110192143.08917.sshtylyov@ru.mvista.com> Cc: vijayanand.jayaraman@in.bosch.com Subject: [U-Boot] [PATCH] fat: correct ATTR_VFAT check X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: J. Vijayanand 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 Signed-off-by: Sergei Shtylyov --- fs/fat/fat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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;