UML and 2.5.43

From: Oleg Drokin (green@namesys.com)
Date: Wed Oct 16 2002 - 03:50:37 EST


Hello!

    I noticed that in 2.5.43 ubd does not work anymore until
    you enable devfs support, since devfs_register is now only
    return meaningful values if devfs is compiled, otherwise it
    just returns NULL, and ubd treats this as error. Since UML
    itself only uses that value for subsequent freeing of devfs node,
    it is quite safe (returned NULL means nothing should be freed
    later ;) )

    Probably attached patch is one of the right things to do.
    As additional bonus it fixes uninitialised variable usage ;)

Bye,
    Oleg

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.859 -> 1.860
# arch/um/drivers/ubd_kern.c 1.10 -> 1.11
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/16 green@angband.namesys.com 1.860
# do not look at return values from devfs_register stuff
# --------------------------------------------
#
diff -Nru a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
--- a/arch/um/drivers/ubd_kern.c Wed Oct 16 12:41:24 2002
+++ b/arch/um/drivers/ubd_kern.c Wed Oct 16 12:41:24 2002
@@ -469,9 +469,7 @@
                               MAJOR_NR, n << UBD_SHIFT,
                               S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP |S_IWGRP,
                               &ubd_blops, NULL);
- if(real == NULL)
- goto out;
- ubd_dev[n].real = real;
+ ubd_dev[n].real = real;
 
         if (fake_major) {
                 fake = devfs_register(ubd_fake_dir_handle, name,
@@ -479,20 +477,16 @@
                                       n << UBD_SHIFT,
                                       S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP |
                                       S_IWGRP, &ubd_blops, NULL);
- if(fake == NULL)
- goto out_unregister;
 
- ubd_dev[n].fake = fake;
+ ubd_dev[n].fake = fake;
                 add_disk(fake_disk);
+
         }
  
         add_disk(disk);
         make_ide_entries(disk->disk_name);
         return(0);
 
- out_unregister:
- devfs_unregister(real);
- ubd_dev[n].real = NULL;
  out:
         return(-1);
 }
@@ -700,6 +694,6 @@
 {
         int n = DEVICE_NR(inode->i_rdev);
         struct ubd *dev = &ubd_dev[n];
- int err;
+ int err = -EISDIR;
         if(dev->is_dir == 1)
                 goto out;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Oct 23 2002 - 22:00:27 EST