ID: 3600926 - 'lib/ipmi_lanp.c'

Commit replaces condition ``if (p == NULL)'' in get_lan_param_select(). This
condition is never met, because structure is on heap.
Condition is replaced by for() control structure which goes through structure
ipmi_lan_params and checks whether requested LAN parameter is defined in
structure or not.

Reported-by: Ales Ledvinka
This commit is contained in:
Zdenek Styblik 2013-03-14 08:38:32 +00:00
parent 4a9af33734
commit ba9a313911

View File

@ -117,14 +117,23 @@ find_lan_channel(struct ipmi_intf * intf, uint8_t start)
static struct lan_param *
get_lan_param_select(struct ipmi_intf * intf, uint8_t chan, int param, int select)
{
struct lan_param * p;
struct lan_param * p = NULL;
struct ipmi_rs * rsp;
struct ipmi_rq req;
int i = 0;
uint8_t msg_data[4];
p = &ipmi_lan_params[param];
if (p == NULL)
for (i = 0; ipmi_lan_params[i].cmd != (-1); i++) {
if (ipmi_lan_params[i].cmd == param) {
p = &ipmi_lan_params[param];
break;
}
}
if (p == NULL) {
lprintf(LOG_INFO, "Get LAN Parameter failed: Unknown parameter.");
return NULL;
}
msg_data[0] = chan;
msg_data[1] = p->cmd;