Commit f27ccb58 authored by Vladimir Serbinenko's avatar Vladimir Serbinenko
Browse files

grub_ata_setaddress: Check that geometry is sane when using CHS addressing.

parent 1dfe3f97
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/ata.c (grub_ata_setaddress): Check that geometry
is sane when using CHS addressing.
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
 
* grub-core/disk/AFSplitter.c (AF_merge): Check that mdlen is not 0.
......@@ -216,6 +216,12 @@ grub_ata_setaddress (struct grub_ata *dev,
unsigned int head;
unsigned int sect;
if (dev->sectors_per_track == 0
|| dev->heads == 0)
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"sector %d cannot be addressed "
"using CHS addressing", sector);
/* Calculate the sector, cylinder and head to use. */
sect = ((grub_uint32_t) sector % dev->sectors_per_track) + 1;
cylinder = (((grub_uint32_t) sector / dev->sectors_per_track)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment