From: Tomas Henzl <thenzl@redhat.com> Date: Sun, 29 Aug 2010 15:49:54 -0400 Subject: [block] cciss: make cciss_seq_show handle drv_array holes Message-id: <1283097002-3341-56-git-send-email-thenzl@redhat.com> Patchwork-id: 27910 O-Subject: [RHEL6 PATCH 55/63] cciss: make cciss_seq_show handle holes in drv_array Bugzilla: 568830 RH-Acked-by: Neil Horman <nhorman@redhat.com> Make cciss_seq_show handle holes in the h->drv[] array. It is possible for there to be holes in the h->drv[] array, that is, some elements may be NULL pointers. cciss_seq_show needs to be made aware of this possibility. diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 58fd681..bb84cba 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -413,9 +413,12 @@ static int cciss_seq_show(struct seq_file *seq, void *v) if (*pos > h->highest_lun) return 0; - if (drv->heads == 0) + if (drv == NULL) /* it's possible for h->drv[] to have holes. */ return 0; + if (drv->heads == 0) + return 0; + vol_sz = drv->nr_blocks; vol_sz_frac = sector_div(vol_sz, ENG_GIG_FACTOR); vol_sz_frac *= 100;