public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Donggeun Kim <dg77.kim@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] FAT: fix some issues in FAT write support code
Date: Fri, 16 Dec 2011 16:47:58 +0900	[thread overview]
Message-ID: <4EEAF7AE.3020406@samsung.com> (raw)
In-Reply-To: <1323954734-26775-1-git-send-email-agust@denx.de>

On 2011? 12? 15? 22:12, Anatolij Gustschin wrote:
> Writing a file to the FAT partition didn't work while a
> test using a CF card. The test was done on mpc5200 based
> board (powerpc). There is a number of problems in FAT
> write code:
> 
> Compiler warning:
> fat_write.c: In function 'file_fat_write':
> fat_write.c:326: warning: 'counter' may be used uninitialized
> in this function
> fat_write.c:326: note: 'counter' was declared here
> 
> 'l_filename' string is not terminated, so a file name
> with garbage at the end is used as a file name as shown
> by debug code.
> 
> Return value of set_contents() is not checked properly
> so actually a file won't be written at all (as checked
> using 'fatls' after a write attempt with 'fatwrite'
> command).
> 
> do_fat_write() doesn't return the number of written bytes
> if no error happened. However the return value of this
> function is used to show the number of written bytes
> in do_fat_fswrite().
> 
> The patch adds some debug code and fixes above mentioned
> problems and also fixes a typo in error output.
> 
> NOTE: after a successful write to the FAT partition (under
> U-Boot) the partition was checked under Linux using fsck.
> The partition needed fixing FATs:
> -bash-3.2# fsck -a /dev/sda1
> fsck 1.39 (29-May-2006)
> dosfsck 2.11, 12 Mar 2005, FAT32, LFN
> FATs differ but appear to be intact. Using first FAT.
> Performing changes.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> Cc: Donggeun Kim <dg77.kim@samsung.com>
> Cc: Aaron Williams <Aaron.Williams@cavium.com>
Acked-by: Donggeun Kim <dg77.kim@samsung.com>

Thanks.
-Donggeun

  reply	other threads:[~2011-12-16  7:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-15 13:12 [U-Boot] [PATCH] FAT: fix some issues in FAT write support code Anatolij Gustschin
2011-12-16  7:47 ` Donggeun Kim [this message]
2011-12-20 22:18 ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EEAF7AE.3020406@samsung.com \
    --to=dg77.kim@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox