grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] biosdisk / open_device() messing up offsets


From: Robert Millan
Subject: Re: [PATCH] biosdisk / open_device() messing up offsets
Date: Fri, 6 Jun 2008 17:56:49 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

Committed.

On Thu, Jun 05, 2008 at 01:35:36AM +0200, Robert Millan wrote:
> 
> It seems that open_device() in biosdisk is messing up offsets when
> accessing partitions.  For example if you try:
> 
> grub> hexdump (hd0,1)
> 
> in grub-emu, you'll get a message saying lseek failed.  The problem is that
> it substracts to the sector offset, so all accesses get to wrong data and
> accessing sector 0 results in underflow.
> 
> I would think those lines (see patch) are plainly wrong, but they appear to
> be very old, and it is strange that this wasn't noticed earlier.  Maybe we
> have changed behaviour around partition/disk offsets, causing this breakage
> without noticing?
> 
> -- 
> Robert Millan
> 
> <GPLv2> I know my rights; I want my phone call!
> <DRM> What good is a phone call… if you are unable to speak?
> (as seen on /.)

> diff -x ChangeLog -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp 
> ../grub2/util/biosdisk.c ./util/biosdisk.c
> --- ../grub2/util/biosdisk.c  2008-06-04 16:00:30.000000000 +0200
> +++ ./util/biosdisk.c 2008-06-05 01:17:00.000000000 +0200
> @@ -298,9 +298,6 @@ open_device (const grub_disk_t disk, gru
>  
>      /* Make the buffer cache consistent with the physical disk.  */
>      ioctl (fd, BLKFLSBUF, 0);
> -    
> -    if (is_partition)
> -      sector -= disk->partition->start;
>    }
>  #else /* ! __linux__ */
>    fd = open (map[disk->id].device, flags);

> _______________________________________________
> Grub-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/grub-devel


-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]