ID: 3578277 - 'lib/ipmi_fru.c' - possible NULL pointer

Commit fixes possible NULL pointer by adding check whether fru_bloc, returned
from build_fru_bloc(), is NULL or not. If it is, print an error message and
return (-1).
This commit is contained in:
Zdenek Styblik 2012-10-19 07:01:40 +00:00
parent d65cccc32a
commit a9f7a7b92e

View File

@ -497,6 +497,11 @@ write_fru_area(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id,
t_ipmi_fru_bloc * fru_bloc = build_fru_bloc(intf, fru, id, &num_bloc); t_ipmi_fru_bloc * fru_bloc = build_fru_bloc(intf, fru, id, &num_bloc);
if (fru_bloc == NULL) {
lprintf(LOG_ERROR, "Failed to build FRU bloc.");
return (-1);
}
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_STORAGE; req.msg.netfn = IPMI_NETFN_STORAGE;
req.msg.cmd = SET_FRU_DATA; req.msg.cmd = SET_FRU_DATA;