All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinz Mauelshagen <heinzm@redhat.com>
To: dm-devel@redhat.com
Cc: heinzm@redhat.com
Subject: [PATCH] Check region size during dirty log creation
Date: Wed, 29 Oct 2008 14:02:08 +0100	[thread overview]
Message-ID: <1225285328.3974.5.camel@o> (raw)

This patch adds checks to the dirty log creation for region size to be
larger than 2 sectors and to be a power of 2.

Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
---

diff -up linux-2.6.27.4/drivers/md/dm-log.c.orig
linux-2.6.27.4/drivers/md/dm-log.c
--- linux-2.6.27.4/drivers/md/dm-log.c.log	2008-10-29 13:51:03.000000000
+0100
+++ linux-2.6.27.4/drivers/md/dm-log.c	2008-10-29 13:55:57.000000000
+0100
@@ -403,8 +403,10 @@ static int create_log_context(struct dm_
 		}
 	}
 
-	if (sscanf(argv[0], "%u", &region_size) != 1) {
-		DMWARN("invalid region size string");
+	if (sscanf(argv[0], "%u", &region_size) != 1 ||
+	    region_size < 2 ||
+	    (region_size & (region_size - 1))) {
+		DMWARN("invalid region size");
 		return -EINVAL;
 	}
 

             reply	other threads:[~2008-10-29 13:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29 13:02 Heinz Mauelshagen [this message]
2008-10-29 13:56 ` [PATCH] Check region size during dirty log creation Alasdair G Kergon
2008-10-29 15:07   ` Heinz Mauelshagen
2008-10-29 15:43     ` Alasdair G Kergon
2008-10-29 15:53       ` Heinz Mauelshagen
2008-10-29 20:51         ` Alasdair G Kergon

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=1225285328.3974.5.camel@o \
    --to=heinzm@redhat.com \
    --cc=dm-devel@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.