• Badari Pulavarty's avatar
    Isn't sd_major() broken ? · bb9e1c7a
    Badari Pulavarty authored
    I am little confused about the correctness of sd_major() in drivers/scsi/sd.c.
    
    static int sd_major(int major_idx)
    {
            switch (major_idx) {
            case 0:
                    return SCSI_DISK0_MAJOR;
            case 1 ... 7:
                    return SCSI_DISK1_MAJOR + major_idx - 1;
            case 8 ... 15:
                    return SCSI_DISK8_MAJOR + major_idx;
            default:
                    BUG();
                    return 0;       /* shut up gcc */
            }
    }
    
    So, if major_idx = 8, It returns 143. 
    But according to major.h, scsi has 128-135 reserved
    majors. But it is registering 136 - 143 as its majors.
    
    #define SCSI_DISK8_MAJOR        128
    #define SCSI_DISK9_MAJOR        129
    #define SCSI_DISK10_MAJOR       130
    #define SCSI_DISK11_MAJOR       131
    #define SCSI_DISK12_MAJOR       132
    #define SCSI_DISK13_MAJOR       133
    #define SCSI_DISK14_MAJOR       134
    #define SCSI_DISK15_MAJOR       135
    bb9e1c7a
sd.c 41.7 KB