mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
Dmitry Konyshev 1/23/09 sdr-read-fix patch to fix a crash when dumping SDRs in a file and there's an error getting an sdr. Improve algorithm for finding optimal packet size
This commit is contained in:
parent
928da786e5
commit
025f196aec
@ -2743,14 +2743,21 @@ ipmi_sdr_get_record(struct ipmi_intf * intf, struct sdr_get_rs * header,
|
|||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (rsp == NULL) {
|
||||||
|
sdr_max_read_len = sdr_rq.length - 1;
|
||||||
|
if (sdr_max_read_len > 0) {
|
||||||
|
/* no response may happen if requests are bridged
|
||||||
|
and too many bytes are requested */
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
free(data);
|
free(data);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (rsp->ccode) {
|
switch (rsp->ccode) {
|
||||||
case 0xca:
|
case 0xca:
|
||||||
/* read too many bytes at once */
|
/* read too many bytes at once */
|
||||||
sdr_max_read_len = (sdr_max_read_len >> 1) - 1;
|
sdr_max_read_len = sdr_rq.length - 1;
|
||||||
continue;
|
continue;
|
||||||
case 0xc5:
|
case 0xc5:
|
||||||
/* lost reservation */
|
/* lost reservation */
|
||||||
@ -4037,6 +4044,11 @@ ipmi_sdr_dump_bin(struct ipmi_intf *intf, const char *ofile)
|
|||||||
sdrr->length = header->length;
|
sdrr->length = header->length;
|
||||||
sdrr->raw = ipmi_sdr_get_record(intf, header, itr);
|
sdrr->raw = ipmi_sdr_get_record(intf, header, itr);
|
||||||
|
|
||||||
|
if (sdrr->raw == NULL) {
|
||||||
|
lprintf(LOG_ERR, "ipmitool: cannot obtain SDR record %04x", header->id);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (sdr_list_head == NULL)
|
if (sdr_list_head == NULL)
|
||||||
sdr_list_head = sdrr;
|
sdr_list_head = sdrr;
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user