FIX: Prevent using null list pointer

When not all attributes are supported (attributes incompatibility)
function container_content_imsm returns NULL pointer.
We need to cope with a NULL list better.

Reported-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2011-09-07 12:45:24 +10:00
parent ba71445069
commit 75c2df6509
2 changed files with 3 additions and 1 deletions

View File

@ -1464,7 +1464,7 @@ static int Incremental_container(struct supertype *st, char *devname,
fprintf(stderr, Name ": failed to get exclusive lock on "
"mapfile\n");
/* do not assemble arrays that might have bad blocks */
if (list->array.state & (1<<MD_SB_BBM_ERRORS)) {
if (list && list->array.state & (1<<MD_SB_BBM_ERRORS)) {
fprintf(stderr, Name ": BBM log found in metadata. "
"Cannot activate array(s).\n");
/* free container data and exit */

View File

@ -678,6 +678,8 @@ struct domainlist *domain_from_array(struct mdinfo *mdi, const char *metadata)
{
struct domainlist *domlist = NULL;
if (!mdi)
return NULL;
for (mdi = mdi->devs ; mdi ; mdi = mdi->next)
domainlist_add_dev(&domlist, makedev(mdi->disk.major,
mdi->disk.minor),