* grub-core/commands/hdparm.c (le16_to_char): Always byte-swap strings.
(grub_ata_strncpy): Likewise. (grub_ata_identify): Add missing byteswaps.
This commit is contained in:
parent
5e3535aee7
commit
b7b4ab33ae
3 changed files with 14 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
|||
2012-06-06 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/commands/hdparm.c (le16_to_char): Always byte-swap strings.
|
||||
(grub_ata_strncpy): Likewise.
|
||||
(grub_ata_identify): Add missing byteswaps.
|
||||
|
||||
2012-06-06 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/term/i386/pc/vga_text.c (screen_write_char): Add missing
|
||||
|
|
|
@ -169,7 +169,7 @@ le16_to_char (grub_uint16_t *dest, const grub_uint16_t * src16, unsigned bytes)
|
|||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < bytes / 2; i++)
|
||||
dest[i] = grub_be_to_cpu16 (src16[i]);
|
||||
dest[i] = grub_swap_bytes16 (src16[i]);
|
||||
dest[i] = 0;
|
||||
return (char *) dest;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ grub_ata_strncpy (grub_uint16_t *dst16, grub_uint16_t *src16, grub_size_t len)
|
|||
unsigned int i;
|
||||
|
||||
for (i = 0; i < len / 2; i++)
|
||||
*(dst16++) = grub_be_to_cpu16 (*(src16++));
|
||||
*(dst16++) = grub_swap_bytes16 (*(src16++));
|
||||
*dst16 = 0;
|
||||
}
|
||||
|
||||
|
@ -156,10 +156,10 @@ grub_ata_identify (struct grub_ata *dev)
|
|||
dev->addr = GRUB_ATA_CHS;
|
||||
|
||||
/* Check if LBA is supported. */
|
||||
if (info16[49] & (1 << 9))
|
||||
if (info16[49] & grub_cpu_to_le16_compile_time ((1 << 9)))
|
||||
{
|
||||
/* Check if LBA48 is supported. */
|
||||
if (info16[83] & (1 << 10))
|
||||
if (info16[83] & grub_cpu_to_le16_compile_time ((1 << 10)))
|
||||
dev->addr = GRUB_ATA_LBA48;
|
||||
else
|
||||
dev->addr = GRUB_ATA_LBA;
|
||||
|
@ -171,7 +171,7 @@ grub_ata_identify (struct grub_ata *dev)
|
|||
else
|
||||
dev->size = grub_le_to_cpu64 (info64[25]);
|
||||
|
||||
if (info16[106] & (1 << 12))
|
||||
if (info16[106] & grub_cpu_to_le16_compile_time ((1 << 12)))
|
||||
{
|
||||
grub_uint32_t secsize;
|
||||
secsize = grub_le_to_cpu32 (grub_get_unaligned32 (&info16[117]));
|
||||
|
@ -187,9 +187,9 @@ grub_ata_identify (struct grub_ata *dev)
|
|||
dev->log_sector_size = 9;
|
||||
|
||||
/* Read CHS information. */
|
||||
dev->cylinders = info16[1];
|
||||
dev->heads = info16[3];
|
||||
dev->sectors_per_track = info16[6];
|
||||
dev->cylinders = grub_le_to_cpu16 (info16[1]);
|
||||
dev->heads = grub_le_to_cpu16 (info16[3]);
|
||||
dev->sectors_per_track = grub_le_to_cpu16 (info16[6]);
|
||||
|
||||
grub_ata_dumpinfo (dev, info16);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue