grub2/0150-grub-core-disk-ieee1275-nand.c-grub_nand_open-Check-.patch
Peter Jones 8c6b1ac71e Reconcile with upstream once again.
Also include some minor fixes for gcc 5.1.1

Signed-off-by: Peter Jones <pjones@redhat.com>
2015-07-22 09:46:32 -04:00

46 lines
1.3 KiB
Diff

From f1959b16957bbb49bfaa16471d04bd9efc77387f Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Tue, 20 Jan 2015 15:09:42 +0100
Subject: [PATCH 150/506] * grub-core/disk/ieee1275/nand.c
(grub_nand_open): Check block size validity.
---
ChangeLog | 5 +++++
grub-core/disk/ieee1275/nand.c | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 8661726..bdd5697 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/disk/ieee1275/nand.c (grub_nand_open): Check block size
+ validity.
+
+2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Do not
divide by zero.
diff --git a/grub-core/disk/ieee1275/nand.c b/grub-core/disk/ieee1275/nand.c
index 576e9cc..feffa8c 100644
--- a/grub-core/disk/ieee1275/nand.c
+++ b/grub-core/disk/ieee1275/nand.c
@@ -113,6 +113,11 @@ grub_nand_open (const char *name, grub_disk_t disk)
}
data->block_size = (args.size1 >> GRUB_DISK_SECTOR_BITS);
+ if (!data->block_size)
+ {
+ grub_error (GRUB_ERR_UNKNOWN_DEVICE, "invalid block size");
+ goto fail;
+ }
INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 3);
args.method = (grub_ieee1275_cell_t) "size";
--
2.4.3