signed/unsigned audit.
--- diff/drivers/md/dm-exception-store.c	2003-03-27 09:40:08.000000000 +0000
+++ source/drivers/md/dm-exception-store.c	2003-04-17 17:43:53.000000000 +0100
@@ -158,7 +158,8 @@
 
 static int allocate_iobuf(struct pstore *ps)
 {
-	size_t i, r = -ENOMEM, len, nr_pages;
+	int r = -ENOMEM;
+	size_t i, len, nr_pages;
 	struct page *page;
 
 	len = ps->chunk_size << SECTOR_SHIFT;
@@ -355,7 +356,8 @@
  */
 static int insert_exceptions(struct pstore *ps, int *full)
 {
-	int i, r;
+	int r;
+	unsigned int i;
 	struct disk_exception de;
 
 	/* presume the area is full */
@@ -471,7 +473,8 @@
 			      void (*callback) (void *, int success),
 			      void *callback_context)
 {
-	int r, i;
+	int r;
+	unsigned int i;
 	struct pstore *ps = get_info(store);
 	struct disk_exception de;
 	struct commit_callback *cb;
--- diff/drivers/md/dm-ioctl.c	2003-03-27 09:50:51.000000000 +0000
+++ source/drivers/md/dm-ioctl.c	2003-04-17 17:48:46.000000000 +0100
@@ -355,7 +355,8 @@
 
 static int populate_table(struct dm_table *table, struct dm_ioctl *args)
 {
-	int i = 0, r, first = 1;
+	int r, first = 1;
+	unsigned int i = 0;
 	struct dm_target_spec *spec;
 	char *params;
 	void *begin, *end;
@@ -384,7 +385,8 @@
 		}
 
 		r = dm_table_add_target(table, spec->target_type,
-					spec->sector_start, spec->length,
+					(sector_t) spec->sector_start,
+					(sector_t) spec->length,
 					params);
 		if (r) {
 			DMWARN("error adding target to table");
@@ -563,7 +565,7 @@
 	kdev_t dev;
 	struct dm_table *t;
 	struct mapped_device *md;
-	int minor;
+	unsigned int minor = 0;
 
 	r = check_name(param->name);
 	if (r)
@@ -579,8 +581,8 @@
 		return r;
 	}
 
-	minor = (param->flags & DM_PERSISTENT_DEV_FLAG) ?
-		minor(to_kdev_t(param->dev)) : -1;
+	if (param->flags & DM_PERSISTENT_DEV_FLAG)
+		minor = minor(to_kdev_t(param->dev));
 
 	r = dm_create(minor, t, &md);
 	if (r) {
@@ -590,7 +592,7 @@
 	dm_table_put(t);	/* md will have grabbed its own reference */
 
 	dev = dm_kdev(md);
-	set_device_ro(dev, (param->flags & DM_READONLY_FLAG));
+	set_device_ro(dev, (param->flags & DM_READONLY_FLAG) ? 1 : 0);
 	r = dm_hash_insert(param->name, *param->uuid ? param->uuid : NULL, md);
 	dm_put(md);
 
@@ -601,9 +603,9 @@
  * Build up the status struct for each target
  */
 static int __status(struct mapped_device *md, struct dm_ioctl *param,
-		    char *outbuf, int *len)
+		    char *outbuf, size_t *len)
 {
-	int i, num_targets;
+	unsigned int i, num_targets;
 	struct dm_target_spec *spec;
 	char *outptr;
 	status_type_t type;
@@ -663,7 +665,7 @@
 static int get_status(struct dm_ioctl *param, struct dm_ioctl *user)
 {
 	struct mapped_device *md;
-	int len = 0;
+	size_t len = 0;
 	int ret;
 	char *outbuf = NULL;
 
@@ -744,7 +746,8 @@
  */
 static int dep(struct dm_ioctl *param, struct dm_ioctl *user)
 {
-	int count, r;
+	int r;
+	unsigned int count;
 	struct mapped_device *md;
 	struct list_head *tmp;
 	size_t len = 0;
@@ -897,7 +900,7 @@
 	dm_table_put(t);	/* md will have taken its own reference */
 
 	dev = dm_kdev(md);
-	set_device_ro(dev, (param->flags & DM_READONLY_FLAG));
+	set_device_ro(dev, (param->flags & DM_READONLY_FLAG) ? 1 : 0);
 	dm_put(md);
 
 	r = info(param, user);
@@ -953,7 +956,7 @@
  * As well as checking the version compatibility this always
  * copies the kernel interface version out.
  */
-static int check_version(int cmd, struct dm_ioctl *user)
+static int check_version(unsigned int cmd, struct dm_ioctl *user)
 {
 	uint32_t version[3];
 	int r = 0;
@@ -1036,7 +1039,8 @@
 static int ctl_ioctl(struct inode *inode, struct file *file,
 		     uint command, ulong u)
 {
-	int r = 0, cmd;
+	int r = 0;
+	unsigned int cmd;
 	struct dm_ioctl *param;
 	struct dm_ioctl *user = (struct dm_ioctl *) u;
 	ioctl_fn fn = NULL;
--- diff/drivers/md/dm-linear.c	2003-03-27 09:39:53.000000000 +0000
+++ source/drivers/md/dm-linear.c	2003-04-17 17:43:53.000000000 +0100
@@ -22,7 +22,7 @@
 /*
  * Construct a linear mapping: <dev_path> <offset>
  */
-static int linear_ctr(struct dm_target *ti, int argc, char **argv)
+static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 {
 	struct linear_c *lc;
 
@@ -76,7 +76,7 @@
 }
 
 static int linear_status(struct dm_target *ti, status_type_t type,
-			 char *result, int maxlen)
+			 char *result, unsigned int maxlen)
 {
 	struct linear_c *lc = (struct linear_c *) ti->private;
 
--- diff/drivers/md/dm-snapshot.c	2003-03-27 09:40:16.000000000 +0000
+++ source/drivers/md/dm-snapshot.c	2003-04-17 17:43:53.000000000 +0100
@@ -202,7 +202,7 @@
  */
 static int init_exception_table(struct exception_table *et, uint32_t size)
 {
-	int i;
+	unsigned int i;
 
 	et->hash_mask = size - 1;
 	et->table = vcalloc(size, sizeof(struct list_head));
@@ -389,7 +389,7 @@
 /*
  * Construct a snapshot mapping: <origin_dev> <COW-dev> <p/n> <chunk-size>
  */
-static int snapshot_ctr(struct dm_target *ti, int argc, char **argv)
+static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 {
 	struct dm_snapshot *s;
 	unsigned long chunk_size;
@@ -936,7 +936,7 @@
 }
 
 static int snapshot_status(struct dm_target *ti, status_type_t type,
-			   char *result, int maxlen)
+			   char *result, unsigned int maxlen)
 {
 	struct dm_snapshot *snap = (struct dm_snapshot *) ti->private;
 	char cow[16];
@@ -1000,7 +1000,7 @@
  * The context for an origin is merely a 'struct dm_dev *'
  * pointing to the real device.
  */
-static int origin_ctr(struct dm_target *ti, int argc, char **argv)
+static int origin_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 {
 	int r;
 	struct dm_dev *dev;
@@ -1039,7 +1039,7 @@
 }
 
 static int origin_status(struct dm_target *ti, status_type_t type, char *result,
-			 int maxlen)
+			 unsigned int maxlen)
 {
 	struct dm_dev *dev = (struct dm_dev *) ti->private;
 
--- diff/drivers/md/dm-stripe.c	2003-03-27 09:42:22.000000000 +0000
+++ source/drivers/md/dm-stripe.c	2003-04-17 17:43:53.000000000 +0100
@@ -29,7 +29,7 @@
 	struct stripe stripe[0];
 };
 
-static inline struct stripe_c *alloc_context(int stripes)
+static inline struct stripe_c *alloc_context(unsigned int stripes)
 {
 	size_t len;
 
@@ -46,7 +46,7 @@
  * Parse a single <dev> <sector> pair
  */
 static int get_stripe(struct dm_target *ti, struct stripe_c *sc,
-		      int stripe, char **argv)
+		      unsigned int stripe, char **argv)
 {
 	sector_t start;
 
@@ -90,14 +90,15 @@
  * Construct a striped mapping.
  * <number of stripes> <chunk size (2^^n)> [<dev_path> <offset>]+
  */
-static int stripe_ctr(struct dm_target *ti, int argc, char **argv)
+static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 {
 	struct stripe_c *sc;
 	sector_t width;
 	uint32_t stripes;
 	uint32_t chunk_size;
 	char *end;
-	int r, i;
+	int r;
+	unsigned int i;
 
 	if (argc < 2) {
 		ti->error = "dm-stripe: Not enough arguments";
@@ -202,11 +203,11 @@
 }
 
 static int stripe_status(struct dm_target *ti,
-			 status_type_t type, char *result, int maxlen)
+			 status_type_t type, char *result, unsigned int maxlen)
 {
 	struct stripe_c *sc = (struct stripe_c *) ti->private;
 	int offset;
-	int i;
+	unsigned int i;
 
 	switch (type) {
 	case STATUSTYPE_INFO:
--- diff/drivers/md/dm-table.c	2003-03-27 09:50:51.000000000 +0000
+++ source/drivers/md/dm-table.c	2003-04-17 17:43:53.000000000 +0100
@@ -22,12 +22,12 @@
 	atomic_t holders;
 
 	/* btree table */
-	int depth;
-	int counts[MAX_DEPTH];	/* in nodes */
+	unsigned int depth;
+	unsigned int counts[MAX_DEPTH];	/* in nodes */
 	sector_t *index[MAX_DEPTH];
 
-	int num_targets;
-	int num_allocated;
+	unsigned int num_targets;
+	unsigned int num_allocated;
 	sector_t *highs;
 	struct dm_target *targets;
 
@@ -74,7 +74,7 @@
 /*
  * Calculate the index of the child node of the n'th node k'th key.
  */
-static inline int get_child(int n, int k)
+static inline unsigned int get_child(unsigned int n, unsigned int k)
 {
 	return (n * CHILDREN_PER_NODE) + k;
 }
@@ -82,7 +82,8 @@
 /*
  * Return the n'th node of level l from table t.
  */
-static inline sector_t *get_node(struct dm_table *t, int l, int n)
+static inline sector_t *get_node(struct dm_table *t,
+				 unsigned int l, unsigned int n)
 {
 	return t->index[l] + (n * KEYS_PER_NODE);
 }
@@ -91,7 +92,7 @@
  * Return the highest key that you could lookup from the n'th
  * node on level l of the btree.
  */
-static sector_t high(struct dm_table *t, int l, int n)
+static sector_t high(struct dm_table *t, unsigned int l, unsigned int n)
 {
 	for (; l < t->depth - 1; l++)
 		n = get_child(n, CHILDREN_PER_NODE - 1);
@@ -106,15 +107,15 @@
  * Fills in a level of the btree based on the highs of the level
  * below it.
  */
-static int setup_btree_index(int l, struct dm_table *t)
+static int setup_btree_index(unsigned int l, struct dm_table *t)
 {
-	int n, k;
+	unsigned int n, k;
 	sector_t *node;
 
-	for (n = 0; n < t->counts[l]; n++) {
+	for (n = 0U; n < t->counts[l]; n++) {
 		node = get_node(t, l, n);
 
-		for (k = 0; k < KEYS_PER_NODE; k++)
+		for (k = 0U; k < KEYS_PER_NODE; k++)
 			node[k] = high(t, l + 1, get_child(n, k));
 	}
 
@@ -125,7 +126,7 @@
  * highs, and targets are managed as dynamic arrays during a
  * table load.
  */
-static int alloc_targets(struct dm_table *t, int num)
+static int alloc_targets(struct dm_table *t, unsigned int num)
 {
 	sector_t *n_highs;
 	struct dm_target *n_targets;
@@ -193,7 +194,7 @@
 
 void table_destroy(struct dm_table *t)
 {
-	int i;
+	unsigned int i;
 
 	/* destroying the table counts as an event */
 	dm_table_event(t);
@@ -558,7 +559,8 @@
 
 static int setup_indexes(struct dm_table *t)
 {
-	int i, total = 0;
+	int i;
+	unsigned int total = 0;
 	sector_t *indexes;
 
 	/* allocate the space for *all* the indexes */
@@ -586,7 +588,8 @@
  */
 int dm_table_complete(struct dm_table *t)
 {
-	int leaf_nodes, r = 0;
+	int r = 0;
+	unsigned int leaf_nodes;
 
 	/* how many indexes will the btree have ? */
 	leaf_nodes = div_up(t->num_targets, KEYS_PER_NODE);
@@ -612,7 +615,7 @@
 	return t->num_targets ? (t->highs[t->num_targets - 1] + 1) : 0;
 }
 
-struct dm_target *dm_table_get_target(struct dm_table *t, int index)
+struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index)
 {
 	if (index > t->num_targets)
 		return NULL;
@@ -625,7 +628,7 @@
  */
 struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector)
 {
-	int l, n = 0, k = 0;
+	unsigned int l, n = 0, k = 0;
 	sector_t *node;
 
 	for (l = 0; l < t->depth; l++) {
--- diff/drivers/md/dm-target.c	2003-01-10 11:49:27.000000000 +0000
+++ source/drivers/md/dm-target.c	2003-04-17 17:43:53.000000000 +0100
@@ -149,7 +149,7 @@
  * io-err: always fails an io, useful for bringing
  * up LVs that have holes in them.
  */
-static int io_err_ctr(struct dm_target *ti, int argc, char **args)
+static int io_err_ctr(struct dm_target *ti, unsigned int argc, char **args)
 {
 	return 0;
 }
--- diff/drivers/md/dm.c	2003-03-27 09:50:51.000000000 +0000
+++ source/drivers/md/dm.c	2003-04-17 17:43:53.000000000 +0100
@@ -21,8 +21,8 @@
 #define MAX_DEVICES (1 << MINORBITS)
 #define DEFAULT_READ_AHEAD 64
 
-static int major = 0;
-static int _major = 0;
+static unsigned int major = 0;
+static unsigned int _major = 0;
 
 struct dm_io {
 	struct mapped_device *md;
@@ -529,7 +529,7 @@
 static spinlock_t _minor_lock = SPIN_LOCK_UNLOCKED;
 static struct mapped_device *_mds[MAX_DEVICES];
 
-static void free_minor(int minor)
+static void free_minor(unsigned int minor)
 {
 	spin_lock(&_minor_lock);
 	_mds[minor] = NULL;
@@ -539,7 +539,7 @@
 /*
  * See if the device with a specific minor # is free.
  */
-static int specific_minor(int minor, struct mapped_device *md)
+static int specific_minor(struct mapped_device *md, unsigned int minor)
 {
 	int r = -EBUSY;
 
@@ -552,14 +552,14 @@
 	spin_lock(&_minor_lock);
 	if (!_mds[minor]) {
 		_mds[minor] = md;
-		r = minor;
+		r = 0;
 	}
 	spin_unlock(&_minor_lock);
 
 	return r;
 }
 
-static int next_free_minor(struct mapped_device *md)
+static int next_free_minor(struct mapped_device *md, unsigned int *minor)
 {
 	int i;
 
@@ -567,12 +567,13 @@
 	for (i = 0; i < MAX_DEVICES; i++) {
 		if (!_mds[i]) {
 			_mds[i] = md;
+			*minor = i;
 			break;
 		}
 	}
 	spin_unlock(&_minor_lock);
 
-	return (i < MAX_DEVICES) ? i : -EBUSY;
+	return (i < MAX_DEVICES) ? 0 : -EBUSY;
 }
 
 static struct mapped_device *get_kdev(kdev_t dev)
@@ -594,8 +595,9 @@
 /*
  * Allocate and initialise a blank device with a given minor.
  */
-static struct mapped_device *alloc_dev(int minor)
+static struct mapped_device *alloc_dev(unsigned int minor)
 {
+	int r;
 	struct mapped_device *md = kmalloc(sizeof(*md), GFP_KERNEL);
 
 	if (!md) {
@@ -604,8 +606,12 @@
 	}
 
 	/* get a minor number for the dev */
-	minor = (minor < 0) ? next_free_minor(md) : specific_minor(minor, md);
-	if (minor < 0) {
+	if (minor)
+		r = specific_minor(md, minor);
+	else
+		r = next_free_minor(md, &minor);
+
+	if (r < 0) {
 		kfree(md);
 		return NULL;
 	}
@@ -688,7 +694,8 @@
 /*
  * Constructor for a new device.
  */
-int dm_create(int minor, struct dm_table *table, struct mapped_device **result)
+int dm_create(unsigned int minor, struct dm_table *table,
+	      struct mapped_device **result)
 {
 	int r;
 	struct mapped_device *md;
--- diff/drivers/md/dm.h	2003-02-13 10:42:23.000000000 +0000
+++ source/drivers/md/dm.h	2003-04-17 17:47:29.000000000 +0100
@@ -53,7 +53,8 @@
  * Functions for manipulating a struct mapped_device.
  * Drop the reference with dm_put when you finish with the object.
  *---------------------------------------------------------------*/
-int dm_create(int minor, struct dm_table *table, struct mapped_device **md);
+int dm_create(unsigned int minor, struct dm_table *table,
+	      struct mapped_device **md);
 
 /*
  * Reference counting for md.
@@ -98,7 +99,7 @@
 int dm_table_complete(struct dm_table *t);
 void dm_table_event(struct dm_table *t);
 sector_t dm_table_get_size(struct dm_table *t);
-struct dm_target *dm_table_get_target(struct dm_table *t, int index);
+struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index);
 struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector);
 unsigned int dm_table_get_num_targets(struct dm_table *t);
 struct list_head *dm_table_get_devices(struct dm_table *t);
--- diff/drivers/md/kcopyd.c	2003-02-13 10:42:23.000000000 +0000
+++ source/drivers/md/kcopyd.c	2003-04-17 17:43:53.000000000 +0100
@@ -127,7 +127,7 @@
 
 static int init_buffers(void)
 {
-	int i;
+	unsigned int i;
 	struct buffer_head *buffers;
 
 	buffers = vcalloc(NUM_BUFFERS, sizeof(struct buffer_head));
@@ -318,7 +318,7 @@
 }
 
 static void dispatch_bh(struct kcopyd_job *job,
-			struct buffer_head *bh, int block)
+			struct buffer_head *bh, unsigned int block)
 {
 	int p;
 
--- diff/include/linux/device-mapper.h	2003-01-10 11:49:27.000000000 +0000
+++ source/include/linux/device-mapper.h	2003-04-17 17:43:53.000000000 +0100
@@ -19,7 +19,8 @@
  * In the constructor the target parameter will already have the
  * table, type, begin and len fields filled in.
  */
-typedef int (*dm_ctr_fn) (struct dm_target *target, int argc, char **argv);
+typedef int (*dm_ctr_fn) (struct dm_target *target,
+			  unsigned int argc, char **argv);
 
 /*
  * The destructor doesn't need to free the dm_target, just
@@ -47,7 +48,7 @@
 			    struct buffer_head *bh, int rw, int error,
 			    void *map_context);
 typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type,
-			     char *result, int maxlen);
+			     char *result, unsigned int maxlen);
 
 void dm_error(const char *message);
 
