mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-28 15:46:53 +00:00
f74b50e380
Signed-off-by: Peter Jones <pjones@redhat.com>
47 lines
1.6 KiB
Diff
47 lines
1.6 KiB
Diff
From 55a1c78a484d48c96291f0f2891745d8b60c2201 Mon Sep 17 00:00:00 2001
|
|
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
Date: Mon, 7 Jan 2013 11:27:18 +0100
|
|
Subject: [PATCH 089/482] * grub-core/fs/minix.c (grub_minix_read_file):
|
|
Simplify arithmetics.
|
|
|
|
---
|
|
ChangeLog | 4 ++++
|
|
grub-core/fs/minix.c | 8 ++++----
|
|
2 files changed, 8 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/ChangeLog b/ChangeLog
|
|
index af29161..cdb3f3d 100644
|
|
--- a/ChangeLog
|
|
+++ b/ChangeLog
|
|
@@ -1,3 +1,7 @@
|
|
+2013-01-07 Vladimir Serbinenko <phcoder@gmail.com>
|
|
+
|
|
+ * grub-core/fs/minix.c (grub_minix_read_file): Simplify arithmetics.
|
|
+
|
|
2013-01-05 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
|
* grub-core/fs/ext2.c (grub_ext2_read_block): Use shifts rather than
|
|
diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c
|
|
index 1e1c13b..a622533 100644
|
|
--- a/grub-core/fs/minix.c
|
|
+++ b/grub-core/fs/minix.c
|
|
@@ -261,12 +261,12 @@ grub_minix_read_file (struct grub_minix_data *data,
|
|
/* Adjust len so it we can't read past the end of the file. */
|
|
if (len + pos > GRUB_MINIX_INODE_SIZE (data))
|
|
len = GRUB_MINIX_INODE_SIZE (data) - pos;
|
|
+ if (len == 0)
|
|
+ return 0;
|
|
|
|
/* Files are at most 2G/4G - 1 bytes on minixfs. Avoid 64-bit division. */
|
|
- blockcnt = ((grub_uint32_t) ((len + pos
|
|
- + (data->block_size << GRUB_DISK_SECTOR_BITS)
|
|
- - 1)
|
|
- >> GRUB_DISK_SECTOR_BITS)) / data->block_size;
|
|
+ blockcnt = ((grub_uint32_t) ((len + pos - 1)
|
|
+ >> GRUB_DISK_SECTOR_BITS)) / data->block_size + 1;
|
|
posblock = (((grub_uint32_t) pos)
|
|
/ (data->block_size << GRUB_DISK_SECTOR_BITS));
|
|
blockoff = (((grub_uint32_t) pos)
|
|
--
|
|
1.8.2.1
|
|
|