2010-08-29 15:01:22

by Andreas Rid

[permalink] [raw]
Subject: [patch] e4defrag: relevant file fragmentation: fix arithmetic error as non-root

hi Kazuya Mio,

I found a bug on your patch "[RFC][PATCH V2 5/5] e4defrag: add solving relevant file fragmentation mode"

The variable "blocks_per_group" is only initialized as root cause of restrict access to the super-block.
As a non root user this cause an arithmetic error in function relevant_balloc.

diff --git a/misc/e4defrag.c b/misc/e4defrag.c
index 3f1df05..6022758 100644
--- a/misc/e4defrag.c
+++ b/misc/e4defrag.c
@@ -1662,14 +1662,15 @@ static int relevant_balloc(const char *file, int donor_fd,

/* Allocating all blocks in an extent group */
while (rest > 0) {
- int grp_offset;
- grp_offset = (pi.pi_pstart - first_data_block) % bpg;


2010-09-01 08:12:05

by Kazuya Mio

[permalink] [raw]
Subject: Re: [patch] e4defrag: relevant file fragmentation: fix arithmetic error as non-root

Hi Andreas,

I will send the patch "[RFC][PATCH V2 5/5] e4defrag: add solving relevant file
fragmentation mode" includes your patches next time.

2010/08/30 0:01, Andreas Rid wrote:
> I found a bug on your patch "[RFC][PATCH V2 5/5] e4defrag: add solving relevant file fragmentation mode"
>
> The variable "blocks_per_group" is only initialized as root cause of restrict access to the super-block.
> As a non root user this cause an arithmetic error in function relevant_balloc

You're right. Thanks.

Regards,
Kazuya Mio