grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix incorrect address reference in btrfs
@ 2014-08-14 10:17 Michael Chang
  2014-08-14 10:50 ` Michael Chang
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Chang @ 2014-08-14 10:17 UTC (permalink / raw)
  To: grub-devel; +Cc: Michael Chang

We encountered a weird random kernel initrd unpacking error on btrfs
and finally found it was caused by incorrect address reference in range
check for type GRUB_BTRFS_EXTENT_REGULAR and the entire result is
unpredictable.

This is a quick fix to make the address reference to the
grub_btrfs_entent_data structure correctly, not the pointer variable
to it.

Any suggestions to this patch is welcome.
---
 grub-core/fs/btrfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index f7b6c15..95a8fa6 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -1051,7 +1051,7 @@ grub_btrfs_extent_read (struct grub_btrfs_data *data,
 
 	  data->extend = data->extstart + grub_le_to_cpu64 (data->extent->size);
 	  if (data->extent->type == GRUB_BTRFS_EXTENT_REGULAR
-	      && (char *) &data->extent + elemsize
+	      && (char *) data->extent + elemsize
 	      >= (char *) &data->extent->filled + sizeof (data->extent->filled))
 	    data->extend =
 	      data->extstart + grub_le_to_cpu64 (data->extent->filled);
-- 
1.7.3.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-08 10:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-14 10:17 [PATCH] Fix incorrect address reference in btrfs Michael Chang
2014-08-14 10:50 ` Michael Chang
2014-09-08 10:34   ` Colin Watson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).