linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Rid <andreas@rid-net.de>
To: k-mio@sx.jp.nec.com
Cc: linux-ext4@vger.kernel.org
Subject: [patch] e4defrag: relevant file fragmentation: fix arithmetic error as non-root
Date: Sun, 29 Aug 2010 17:01:25 +0200	[thread overview]
Message-ID: <4C7A7645.8010906@rid-net.de> (raw)

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;

             reply	other threads:[~2010-08-29 15:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-29 15:01 Andreas Rid [this message]
2010-09-01  8:09 ` [patch] e4defrag: relevant file fragmentation: fix arithmetic error as non-root Kazuya Mio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C7A7645.8010906@rid-net.de \
    --to=andreas@rid-net.de \
    --cc=k-mio@sx.jp.nec.com \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).