* [PATCH] Fix hfsplus.
@ 2009-08-22 19:43 Vladimir 'phcoder' Serbinenko
2009-08-23 11:01 ` Robert Millan
2009-08-28 13:39 ` Yves Blusseau
0 siblings, 2 replies; 3+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-08-22 19:43 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 256 bytes --]
Hello. In multiple places hfsplus aborts if read_file returns 0. But
in this case grub_error isn't set so the errors aren't propagated.
Here is fix.
--
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
[-- Attachment #2: hfsplus.diff --]
[-- Type: text/plain, Size: 2678 bytes --]
diff --git a/fs/hfsplus.c b/fs/hfsplus.c
index 31bb540..5e0ab09 100644
--- a/fs/hfsplus.c
+++ b/fs/hfsplus.c
@@ -469,9 +469,9 @@ grub_hfsplus_mount (grub_disk_t disk)
grub_be_to_cpu64 (data->volheader.extents_file.size);
/* Read the essential information about the trees. */
- if (! grub_hfsplus_read_file (&data->catalog_tree.file, 0,
- sizeof (struct grub_hfsplus_btnode),
- sizeof (header), (char *) &header))
+ if (grub_hfsplus_read_file (&data->catalog_tree.file, 0,
+ sizeof (struct grub_hfsplus_btnode),
+ sizeof (header), (char *) &header) <= 0)
goto fail;
data->catalog_tree.root = grub_be_to_cpu32 (header.root);
@@ -479,15 +479,15 @@ grub_hfsplus_mount (grub_disk_t disk)
data->case_sensitive = ((magic == GRUB_HFSPLUSX_MAGIC) &&
(header.key_compare == GRUB_HFSPLUSX_BINARYCOMPARE));
- if (! grub_hfsplus_read_file (&data->extoverflow_tree.file, 0,
- sizeof (struct grub_hfsplus_btnode),
- sizeof (header), (char *) &header))
+ if (grub_hfsplus_read_file (&data->extoverflow_tree.file, 0,
+ sizeof (struct grub_hfsplus_btnode),
+ sizeof (header), (char *) &header) <= 0)
goto fail;
data->extoverflow_tree.root = grub_be_to_cpu32 (header.root);
- if (! grub_hfsplus_read_file (&data->extoverflow_tree.file, 0, 0,
- sizeof (node), (char *) &node))
+ if (grub_hfsplus_read_file (&data->extoverflow_tree.file, 0, 0,
+ sizeof (node), (char *) &node) <= 0)
goto fail;
data->extoverflow_tree.root = grub_be_to_cpu32 (header.root);
@@ -608,10 +608,10 @@ grub_hfsplus_btree_iterate_node (struct grub_hfsplus_btree *btree,
if (! first_node->next)
break;
- if (! grub_hfsplus_read_file (&btree->file, 0,
- (grub_be_to_cpu32 (first_node->next)
- * btree->nodesize),
- btree->nodesize, cnode))
+ if (grub_hfsplus_read_file (&btree->file, 0,
+ (grub_be_to_cpu32 (first_node->next)
+ * btree->nodesize),
+ btree->nodesize, cnode) <= 0)
return 1;
/* Don't skip any record in the next iteration. */
@@ -647,12 +647,12 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree,
int match = 0;
/* Read a node. */
- if (! grub_hfsplus_read_file (&btree->file, 0,
- (long)currnode * (long)btree->nodesize,
- btree->nodesize, (char *) node))
+ if (grub_hfsplus_read_file (&btree->file, 0,
+ (long)currnode * (long)btree->nodesize,
+ btree->nodesize, (char *) node) <= 0)
{
grub_free (node);
- return grub_errno;
+ return grub_error (GRUB_ERR_BAD_FS, "Couldn't read i-node.");
}
nodedesc = (struct grub_hfsplus_btnode *) node;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix hfsplus.
2009-08-22 19:43 [PATCH] Fix hfsplus Vladimir 'phcoder' Serbinenko
@ 2009-08-23 11:01 ` Robert Millan
2009-08-28 13:39 ` Yves Blusseau
1 sibling, 0 replies; 3+ messages in thread
From: Robert Millan @ 2009-08-23 11:01 UTC (permalink / raw)
To: The development of GRUB 2
On Sat, Aug 22, 2009 at 09:43:24PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> Hello. In multiple places hfsplus aborts if read_file returns 0. But
> in this case grub_error isn't set so the errors aren't propagated.
> Here is fix.
Please go ahead.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix hfsplus.
2009-08-22 19:43 [PATCH] Fix hfsplus Vladimir 'phcoder' Serbinenko
2009-08-23 11:01 ` Robert Millan
@ 2009-08-28 13:39 ` Yves Blusseau
1 sibling, 0 replies; 3+ messages in thread
From: Yves Blusseau @ 2009-08-28 13:39 UTC (permalink / raw)
To: The development of GRUB 2
Le 22 août 09 à 21:43, Vladimir 'phcoder' Serbinenko a écrit :
> Hello. In multiple places hfsplus aborts if read_file returns 0. But
> in this case grub_error isn't set so the errors aren't propagated.
> Here is fix.
Compiled and checked on OSX: great job, no more grub crash in case of
AppleRaid partitions.
Regards,
Yves
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-08-28 13:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-22 19:43 [PATCH] Fix hfsplus Vladimir 'phcoder' Serbinenko
2009-08-23 11:01 ` Robert Millan
2009-08-28 13:39 ` Yves Blusseau
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.