mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
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:
parent
4a9af33734
commit
ba9a313911
@ -117,14 +117,23 @@ find_lan_channel(struct ipmi_intf * intf, uint8_t start)
|
|||||||
static struct lan_param *
|
static struct lan_param *
|
||||||
get_lan_param_select(struct ipmi_intf * intf, uint8_t chan, int param, int select)
|
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_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
|
int i = 0;
|
||||||
uint8_t msg_data[4];
|
uint8_t msg_data[4];
|
||||||
|
|
||||||
|
for (i = 0; ipmi_lan_params[i].cmd != (-1); i++) {
|
||||||
|
if (ipmi_lan_params[i].cmd == param) {
|
||||||
p = &ipmi_lan_params[param];
|
p = &ipmi_lan_params[param];
|
||||||
if (p == NULL)
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p == NULL) {
|
||||||
|
lprintf(LOG_INFO, "Get LAN Parameter failed: Unknown parameter.");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
msg_data[0] = chan;
|
msg_data[0] = chan;
|
||||||
msg_data[1] = p->cmd;
|
msg_data[1] = p->cmd;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user