grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 09/17] fs: When checking if a block list goes past the end of


From: Patrick Steinhardt
Subject: Re: [PATCH 09/17] fs: When checking if a block list goes past the end of the disk, make sure the total size of the disk is in grub native sector sizes, otherwise there will be blocks at the end of the disk unaccessible by block lists.
Date: Thu, 30 Jul 2020 17:26:26 +0200

On Wed, Jul 29, 2020 at 04:50:14PM -0500, development@efficientek.com wrote:
> From: Glenn Washburn <development@efficientek.com>

The commit message header is quite long. Could you please shorten it to
at most 80 characters and maybe put remaining info into the message
body?

> 
> Signed-off-by: Glenn Washburn <development@efficientek.com>
> ---
>  grub-core/kern/fs.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c
> index fb30da9f4..14c17df74 100644
> --- a/grub-core/kern/fs.c
> +++ b/grub-core/kern/fs.c
> @@ -139,6 +139,7 @@ grub_fs_blocklist_open (grub_file_t file, const char 
> *name)
>    unsigned i;
>    grub_disk_t disk = file->device->disk;
>    struct grub_fs_block *blocks;
> +  grub_size_t total_native_sectors;
>  
>    /* First, count the number of blocks.  */
>    do
> @@ -156,6 +157,7 @@ grub_fs_blocklist_open (grub_file_t file, const char 
> *name)
>      return 0;
>  
>    file->size = 0;
> +  total_native_sectors = disk->total_sectors << (disk->log_sector_size - 
> GRUB_DISK_SECTOR_BITS);
>    p = (char *) name;
>    for (i = 0; i < num; i++)
>      {
> @@ -181,7 +183,7 @@ grub_fs_blocklist_open (grub_file_t file, const char 
> *name)
>         goto fail;
>       }
>  
> -      if (disk->total_sectors < blocks[i].offset + blocks[i].length)
> +      if (total_native_sectors < blocks[i].offset + blocks[i].length)
>       {
>         grub_error (GRUB_ERR_BAD_FILENAME, "beyond the total sectors");
>         goto fail;
> -- 
> 2.25.1
> 

Attachment: signature.asc
Description: PGP signature


reply via email to

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