8c6b1ac71e
Also include some minor fixes for gcc 5.1.1 Signed-off-by: Peter Jones <pjones@redhat.com>
47 lines
1.4 KiB
Diff
47 lines
1.4 KiB
Diff
From f27ccb584ccaf70bfb26b3c893b63124d8563db4 Mon Sep 17 00:00:00 2001
|
|
From: Vladimir Serbinenko <phcoder@gmail.com>
|
|
Date: Tue, 20 Jan 2015 14:16:22 +0100
|
|
Subject: [PATCH 143/506] grub_ata_setaddress: Check that geometry is sane when
|
|
using CHS addressing.
|
|
|
|
---
|
|
ChangeLog | 5 +++++
|
|
grub-core/disk/ata.c | 6 ++++++
|
|
2 files changed, 11 insertions(+)
|
|
|
|
diff --git a/ChangeLog b/ChangeLog
|
|
index 0c85b35..575bd18 100644
|
|
--- a/ChangeLog
|
|
+++ b/ChangeLog
|
|
@@ -1,5 +1,10 @@
|
|
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.
|
|
|
|
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
|
|
diff --git a/grub-core/disk/ata.c b/grub-core/disk/ata.c
|
|
index 2b98849..8ba4e5c 100644
|
|
--- a/grub-core/disk/ata.c
|
|
+++ b/grub-core/disk/ata.c
|
|
@@ -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)
|
|
--
|
|
2.4.3
|
|
|