Skip to contentSkip to conversation

bug fix for the ntfs driver

PATCH In review Bean 3 participants 5 messages Aug 15, 2007 – Nov 10, 2007

lore
Share & tools
lore

Bean

author
#0 lore raw

PATCH 1/1 bug fix for the ntfs driver

Hi,

This patch fix a bug in the ntfs driver which occurs when accessing certain compressed files.

Signature · 35 lines
Bean

2007-08-16  Bean  <[email protected]>

	* fs/ntfs.c (read_block): Bug fix for compressed files.


Index: fs/ntfs.c
===================================================================
RCS file: /sources/grub/grub2/fs/ntfs.c,v
retrieving revision 1.1
diff -u -p -r1.1 ntfs.c
--- fs/ntfs.c	3 Aug 2007 07:44:01 -0000	1.1
+++ fs/ntfs.c	15 Aug 2007 16:15:48 -0000
@@ -665,9 +665,6 @@ read_block (struct grub_ntfs_rlst *ctx,
 	      if (read_run_list (ctx))
 		return grub_errno;
 	    }
-	  if (ctx->target_vcn + 16 < ctx->next_vcn)
-	    return grub_error (GRUB_ERR_BAD_FS,
-			       "Compression block should be 16 sector long");
 	}

       nn = (16 - (ctx->target_vcn & 0xF)) / cpb;
@@ -732,7 +729,9 @@ read_block (struct grub_ntfs_rlst *ctx,
 	      if (buf)
 		{
 		  if (grub_disk_read
-		      (ctx->comp.disk, ctx->curr_lcn * ctx->comp.spc, 0,
+		      (ctx->comp.disk,
+		       (ctx->target_vcn - ctx->curr_vcn +
+			ctx->curr_lcn) * ctx->comp.spc, 0,
 		       nn * (ctx->comp.spc << BLK_SHR), buf))
 		    return grub_errno;
 		  buf += nn * (ctx->comp.spc << BLK_SHR);
#1 lore raw

Bean <[email protected]> writes:

Hi Bean,

Quoted 2 lines

This patch fix a bug in the ntfs driver which occurs when accessing certain compressed files.

Sorry again for the late reply...

Quoted 3 lines

2007-08-16 Bean <[email protected]>

* fs/ntfs.c (read_block): Bug fix for compressed files.

Please describe in the changelog entry what changed, not the functional effect. Examples can be:

- Fix off-by-one error.
- Initialize variable to 9.
- Check if memory allocation fails, in that case return an error.

etc.

Unfortunately I do not understand your change, why it is required and what the error was. Can you please update the changelog entry?

Thanks,
Marco

author
#2 lore raw

Hi,

The problem is caused by the structure of compressed files. In ntfs, 16 clusters is the basic compressed unit. The original code assume that the file will break in 16 cluster long blocks, but in fact, the blocks will be merged if they are stored next to to each other on disk. The new code fix this problem.

* fs/ntfs.c (read_block): Fix a bug caused by adjacent blocks.

Quoted 35 lines · Marco Gerards

Bean <[email protected]> writes:

Hi Bean,

Quoted 2 lines

This patch fix a bug in the ntfs driver which occurs when accessing certain compressed files.

Sorry again for the late reply...

Quoted 3 lines

2007-08-16 Bean <[email protected]>

* fs/ntfs.c (read_block): Bug fix for compressed files.

Please describe in the changelog entry what changed, not the functional effect. Examples can be:

- Fix off-by-one error.
- Initialize variable to 9.
- Check if memory allocation fails, in that case return an error.

etc.

Unfortunately I do not understand your change, why it is required and what the error was. Can you please update the changelog entry?

Thanks,
Marco

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 1 line
Bean
#3 lore raw

Bean <[email protected]> writes:

Hi,

Quoted 7 lines

The problem is caused by the structure of compressed files. In ntfs, 16 clusters is the basic compressed unit. The original code assume that the file will break in 16 cluster long blocks, but in fact, the blocks will be merged if they are stored next to to each other on disk. The new code fix this problem.

* fs/ntfs.c (read_block): Fix a bug caused by adjacent blocks.

Sorry for forgetting about this patch. It should be committed.

Robert, if you have time, can you commit this? I will mark this mail as important... If you don't have the time, I will surely commit it ASAP :-)

--
Marco

#4 lore raw
Quoted 6 lines · Marco Gerards

Sorry for forgetting about this patch. It should be committed.

Robert, if you have time, can you commit this? I will mark this mail as important... If you don't have the time, I will surely commit it ASAP :-)

Done.

Signature · 5 lines
Robert Millan

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