* grub-core/fs/xfs.c (grub_xfs_iterate_dir): Take into account that
inopos might be unaligned.
This commit is contained in:
parent
c0cf26da6b
commit
e72d259fe1
2 changed files with 20 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2011-01-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/fs/xfs.c (grub_xfs_iterate_dir): Take into account that
|
||||||
|
inopos might be unaligned.
|
||||||
|
|
||||||
2011-01-07 Vladimir Serbinenko <phcoder@gmail.com>
|
2011-01-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/disk/mdraid1x_linux.c (grub_mdraid_detect): Add missing
|
* grub-core/disk/mdraid1x_linux.c (grub_mdraid_detect): Add missing
|
||||||
|
|
|
@ -451,18 +451,27 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
|
||||||
for (i = 0; i < diro->inode.data.dir.dirhead.count; i++)
|
for (i = 0; i < diro->inode.data.dir.dirhead.count; i++)
|
||||||
{
|
{
|
||||||
grub_uint64_t ino;
|
grub_uint64_t ino;
|
||||||
void *inopos = (((char *) de)
|
grub_uint8_t *inopos = (((grub_uint8_t *) de)
|
||||||
+ sizeof (struct grub_xfs_dir_entry)
|
+ sizeof (struct grub_xfs_dir_entry)
|
||||||
+ de->len - 1);
|
+ de->len - 1);
|
||||||
char name[de->len + 1];
|
char name[de->len + 1];
|
||||||
|
|
||||||
|
/* inopos might be unaligned. */
|
||||||
if (smallino)
|
if (smallino)
|
||||||
{
|
ino = (((grub_uint32_t) inopos[0]) << 24)
|
||||||
ino = grub_be_to_cpu32 (*(grub_uint32_t *) inopos);
|
| (((grub_uint32_t) inopos[1]) << 16)
|
||||||
ino = grub_cpu_to_be64 (ino);
|
| (((grub_uint32_t) inopos[2]) << 8)
|
||||||
}
|
| (((grub_uint32_t) inopos[3]) << 0);
|
||||||
else
|
else
|
||||||
ino = *(grub_uint64_t *) inopos;
|
ino = (((grub_uint64_t) inopos[0]) << 56)
|
||||||
|
| (((grub_uint64_t) inopos[1]) << 48)
|
||||||
|
| (((grub_uint64_t) inopos[2]) << 40)
|
||||||
|
| (((grub_uint64_t) inopos[3]) << 32)
|
||||||
|
| (((grub_uint64_t) inopos[4]) << 24)
|
||||||
|
| (((grub_uint64_t) inopos[5]) << 16)
|
||||||
|
| (((grub_uint64_t) inopos[6]) << 8)
|
||||||
|
| (((grub_uint64_t) inopos[7]) << 0);
|
||||||
|
ino = grub_cpu_to_be64 (ino);
|
||||||
|
|
||||||
grub_memcpy (name, de->name, de->len);
|
grub_memcpy (name, de->name, de->len);
|
||||||
name[de->len] = '\0';
|
name[de->len] = '\0';
|
||||||
|
|
Loading…
Reference in a new issue