Skip to contentSkip to conversation

memset bug in ext2fs_read_file()

U-Boot-Users Applied Mike Montour 3 participants 3 messages Dec 20, 2007 – Jan 10, 2008

lore
Share & tools
lore
#0 lore raw

Hello,

The ext2fs_read_file() function in fs/ext2/ext2fs.c contains the following line:

  439                         memset (buf, blocksize - skipfirst, 0);

This is incorrect as the prototype of the function has the fill value as the 2nd parameter and the number of bytes as the 3rd:

void *memset(void *b, int c, size_t n);

I don't have any test code that is affected by this bug. I noticed it when I was investigating a different problem (with OpenMoko).

#1 lore raw

Dear Mike,

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

The ext2fs_read_file() function in fs/ext2/ext2fs.c contains the following line:

  439                         memset (buf, blocksize - skipfirst, 0);
Quoted 7 lines

This is incorrect as the prototype of the function has the fill value as the 2nd parameter and the number of bytes as the 3rd:

void *memset(void *b, int c, size_t n);

I don't have any test code that is affected by this bug. I noticed it when I was investigating a different problem (with OpenMoko).

Thanks, applied.

Best regards,

Wolfgang Denk

Signature · 5 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Probably the best operating system in the world  is  the  [operating
system] made for the PDP-11 by Bell Laboratories."
                                           - Ted Nelson, October 1977
#2 lore raw

Hello,

this was bug!
You will run into this situation, when you use a file with "holes" in it. (Not so likely with a systen image).

Best regards

Reinhard Arlt

Quoted 22 lines · Wolfgang Denk

Dear Mike,

Quoted 5 lines · in message <[email protected]> you wrote:

The ext2fs_read_file() function in fs/ext2/ext2fs.c contains the following line:

  439                         memset (buf, blocksize - skipfirst, 0);
Quoted 7 lines

This is incorrect as the prototype of the function has the fill value as the 2nd parameter and the number of bytes as the 3rd:

void *memset(void *b, int c, size_t n);

I don't have any test code that is affected by this bug. I noticed it when I was investigating a different problem (with OpenMoko).

Thanks, applied.

Best regards,

Wolfgang Denk