* [PATCH phosphor-host-ipmid v3] ipmid crashing with simplified VERSION_ID
@ 2016-05-03 0:30 OpenBMC Patches
2016-05-03 0:30 ` OpenBMC Patches
0 siblings, 1 reply; 2+ messages in thread
From: OpenBMC Patches @ 2016-05-03 0:30 UTC (permalink / raw)
To: openbmc
if the VERSION_ID is v0.1 instead of v0.1-1 then the code will crash. The fix is to always check
for a NULL token each time.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/openbmc/phosphor-host-ipmid/85)
<!-- Reviewable:end -->
https://github.com/openbmc/phosphor-host-ipmid/pull/85
Chris Austen (1):
ipmid crashing with simplified VERSION_ID
apphandler.C | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
--
2.8.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH phosphor-host-ipmid v3] ipmid crashing with simplified VERSION_ID
2016-05-03 0:30 [PATCH phosphor-host-ipmid v3] ipmid crashing with simplified VERSION_ID OpenBMC Patches
@ 2016-05-03 0:30 ` OpenBMC Patches
0 siblings, 0 replies; 2+ messages in thread
From: OpenBMC Patches @ 2016-05-03 0:30 UTC (permalink / raw)
To: openbmc
From: Chris Austen <austenc@us.ibm.com>
if the VERSION_ID is v0.1 instead of v0.1-1 then the code will crash. The fix is to always check
for a NULL token each time.
Change ipmitool output to reflect hex value
VERSION_ID is equal to v0.6-36-gece9f78-dirty
I was forcing the '36' to be shown as 36. Turns out
that the ipmitool prepends the "Aux" section with a
'0x' indicating the value is in hex. So Rather then
it show up as 0x36 I made it actually be 0x24.
root@barreleye:~# ./ipmitool -I dbus mc info
IPMI GROUP EXTENTIONS
IPMI GROUP EXTENTIONS
Device ID : 0
Device Revision : 0
Firmware Revision : 0.06
IPMI Version : 2.0
Manufacturer ID : 42817
Manufacturer Name : Unknown (0xA741)
Product ID : 16451 (0x4043)
Product Name : Unknown (0x4043)
Device Available : yes
Provides Device SDRs : no
Additional Device Support :
Sensor Device
SEL Device
FRU Inventory Device
Aux Firmware Rev Info :
0x00
0x24 <---- is decimal 36
0x01
0x00
root@barreleye:~#
---
apphandler.C | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/apphandler.C b/apphandler.C
index 53a83d3..71dba66 100644
--- a/apphandler.C
+++ b/apphandler.C
@@ -100,7 +100,7 @@ typedef struct
{
char major;
char minor;
- uint8_t d[4];
+ uint16_t d[2];
} rev_t;
@@ -119,6 +119,7 @@ int convert_version(const char *p, rev_t *rev)
char *s, *token;
char hexbyte[5];
int l;
+ uint16_t commits;
if (*p != 'v')
return -1;
@@ -135,23 +136,23 @@ int convert_version(const char *p, rev_t *rev)
// Capture the number of commits on top of the minor tag.
// I'm using BE format like the ipmi spec asked for
token = strtok(NULL,".-");
- l = strlen(token);
- if (l > 4)
- l = 4;
- memset(hexbyte,'0', 4);
- memcpy(&hexbyte[4-l], token, l);
- sscanf(&hexbyte[0], "%2hhX", &rev->d[0]);
- sscanf(&hexbyte[2], "%2hhX", &rev->d[1]);
+ if (token) {
+ commits = (int16_t) atoi(token);
+ rev->d[0] = (commits>>8) | (commits<<8);
- rev->d[2] = 0;
+ // commit number we skip
+ token = strtok(NULL,".-");
- // commit number we skip
- token = strtok(NULL,".-");
+ } else {
+ rev->d[0] = 0;
+ }
// Any value of the optional parameter forces it to 1
- token = strtok(NULL,".-");
- rev->d[3] = (token != NULL) ? 1 : 0;
+ if (token)
+ token = strtok(NULL,".-");
+
+ rev->d[1] = (token != NULL) ? 1 : 0;
free(s);
return 0;
--
2.8.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-03 0:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-03 0:30 [PATCH phosphor-host-ipmid v3] ipmid crashing with simplified VERSION_ID OpenBMC Patches
2016-05-03 0:30 ` OpenBMC Patches
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.