Skip to content

Commit

Permalink
cciss: fix some magic numbers in the raid-level decoding
Browse files Browse the repository at this point in the history
cciss: fix some magic numbers in the raid-level decoding

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Stephen M. Cameron authored and Jens Axboe committed Oct 1, 2009
1 parent ce84a8a commit fa52bec
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/block/cciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ static inline void removeQ(CommandList_struct *c)

#include "cciss_scsi.c" /* For SCSI tape support */

#define RAID_UNKNOWN 6

#ifdef CONFIG_PROC_FS

/*
Expand All @@ -268,6 +266,7 @@ static inline void removeQ(CommandList_struct *c)
static const char *raid_label[] = { "0", "4", "1(1+0)", "5", "5+1", "ADG",
"UNKNOWN"
};
#define RAID_UNKNOWN (sizeof(raid_label) / sizeof(raid_label[0])-1)

static struct proc_dir_entry *proc_cciss;

Expand Down Expand Up @@ -341,7 +340,7 @@ static int cciss_seq_show(struct seq_file *seq, void *v)
vol_sz_frac *= 100;
sector_div(vol_sz_frac, ENG_GIG_FACTOR);

if (drv->raid_level > 5)
if (drv->raid_level < 0 || drv->raid_level > RAID_UNKNOWN)
drv->raid_level = RAID_UNKNOWN;
seq_printf(seq, "cciss/c%dd%d:"
"\t%4u.%02uGB\tRAID %s\n",
Expand Down

0 comments on commit fa52bec

Please sign in to comment.