Fix for possible NULL pointer dereference.
Pointer 'this' returned from call to function 'malloc' at line 3795 may be NULL and will be dereferenced at line 3796. Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
5a1920f2c2
commit
0fbd635caa
|
@ -3804,6 +3804,11 @@ static struct mdinfo *container_content_imsm(struct supertype *st)
|
||||||
}
|
}
|
||||||
|
|
||||||
this = malloc(sizeof(*this));
|
this = malloc(sizeof(*this));
|
||||||
|
if (!this) {
|
||||||
|
fprintf(stderr, Name ": failed to allocate %lu bytes\n",
|
||||||
|
sizeof(*this));
|
||||||
|
break;
|
||||||
|
}
|
||||||
memset(this, 0, sizeof(*this));
|
memset(this, 0, sizeof(*this));
|
||||||
this->next = rest;
|
this->next = rest;
|
||||||
|
|
||||||
|
@ -3821,7 +3826,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st)
|
||||||
ord = get_imsm_ord_tbl_ent(dev, slot);
|
ord = get_imsm_ord_tbl_ent(dev, slot);
|
||||||
for (d = super->disks; d ; d = d->next)
|
for (d = super->disks; d ; d = d->next)
|
||||||
if (d->index == idx)
|
if (d->index == idx)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (d == NULL)
|
if (d == NULL)
|
||||||
skip = 1;
|
skip = 1;
|
||||||
|
|
Loading…
Reference in New Issue