* grub-core/fs/minix.c (grub_minix_read_file): Simplify arithmetics.
This commit is contained in:
parent
f797ec85a0
commit
c6f1e92f0b
2 changed files with 8 additions and 4 deletions
|
@ -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>
|
2013-01-05 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/fs/ext2.c (grub_ext2_read_block): Use shifts rather than
|
* grub-core/fs/ext2.c (grub_ext2_read_block): Use shifts rather than
|
||||||
|
|
|
@ -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. */
|
/* Adjust len so it we can't read past the end of the file. */
|
||||||
if (len + pos > GRUB_MINIX_INODE_SIZE (data))
|
if (len + pos > GRUB_MINIX_INODE_SIZE (data))
|
||||||
len = GRUB_MINIX_INODE_SIZE (data) - pos;
|
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. */
|
/* Files are at most 2G/4G - 1 bytes on minixfs. Avoid 64-bit division. */
|
||||||
blockcnt = ((grub_uint32_t) ((len + pos
|
blockcnt = ((grub_uint32_t) ((len + pos - 1)
|
||||||
+ (data->block_size << GRUB_DISK_SECTOR_BITS)
|
>> GRUB_DISK_SECTOR_BITS)) / data->block_size + 1;
|
||||||
- 1)
|
|
||||||
>> GRUB_DISK_SECTOR_BITS)) / data->block_size;
|
|
||||||
posblock = (((grub_uint32_t) pos)
|
posblock = (((grub_uint32_t) pos)
|
||||||
/ (data->block_size << GRUB_DISK_SECTOR_BITS));
|
/ (data->block_size << GRUB_DISK_SECTOR_BITS));
|
||||||
blockoff = (((grub_uint32_t) pos)
|
blockoff = (((grub_uint32_t) pos)
|
||||||
|
|
Loading…
Reference in a new issue