Discussion:
[Ipmitool-devel] [PATCH] ekanalyzer incorrectly parses FRU data
Amelkin, Aleksandr
2014-05-20 08:05:56 UTC
Permalink
Hi.

I've created a patch to address the ill-behaving FRU data decoding code. Please review.

Specifically, the patch does the following:


1. Fixes incorrect behavior on FRUs without Internal Use Area (which is allowed by the specification)

2. Corrects size calculation for Internal Use Area (finds the start of the actual next section instead of blindly assuming that the next section is Chasiss Info)

3. Reduces the amount of copy/pasted code and magic numbers

4. Corrects error messages to say the truth (that it couldn't read something) instead of spitting out false claims (that something was "invalid").

5. Reduces nesting level by getting rid of "while(0)/break" in favor of simple "goto".

The patch was originally created for 1.8.13, but has been adjusted to cleanly apply to 1.8.14.

I attached two versions of the patch. One (eka-1.8.14.diff) is the full version, and the other (eka-1.8.14-nospace.diff)
is the version containing essential changes only, omitting all whitespace changes (indentations, etc.) for ease of review.

It's a pity that 1.8.14 now doesn't allow calling 'ekanalyzer frushow sm=<filename>' without specifying
a full set of target options, for the aforementioned ekanalyzer command doesn't need them anyway and operates on a local file.
But that's another patch, I guess. :)

Another thing I would suggest to put on the ToDo list is adding checksum checking to this code.

With best regards -
Alexander Amelkin
Amelkin, Aleksandr
2014-05-20 10:44:59 UTC
Permalink
I've also created a ticket for this:
https://sourceforge.net/p/ipmitool/bugs/314/

Sorry, if this patch is inappropriate in the mailing list.

From: Amelkin, Aleksandr [mailto:***@t-platforms.ru]
Sent: Tuesday, May 20, 2014 12:06 PM
To: ipmitool-***@lists.sourceforge.net
Subject: [Ipmitool-devel] [PATCH] ekanalyzer incorrectly parses FRU data

Hi.

I've created a patch to address the ill-behaving FRU data decoding code. Please review.

Specifically, the patch does the following:


1. Fixes incorrect behavior on FRUs without Internal Use Area (which is allowed by the specification)

2. Corrects size calculation for Internal Use Area (finds the start of the actual next section instead of blindly assuming that the next section is Chasiss Info)

3. Reduces the amount of copy/pasted code and magic numbers

4. Corrects error messages to say the truth (that it couldn't read something) instead of spitting out false claims (that something was "invalid").

5. Reduces nesting level by getting rid of "while(0)/break" in favor of simple "goto".

The patch was originally created for 1.8.13, but has been adjusted to cleanly apply to 1.8.14.

I attached two versions of the patch. One (eka-1.8.14.diff) is the full version, and the other (eka-1.8.14-nospace.diff)
is the version containing essential changes only, omitting all whitespace changes (indentations, etc.) for ease of review.

It's a pity that 1.8.14 now doesn't allow calling 'ekanalyzer frushow sm=<filename>' without specifying
a full set of target options, for the aforementioned ekanalyzer command doesn't need them anyway and operates on a local file.
But that's another patch, I guess. :)

Another thing I would suggest to put on the ToDo list is adding checksum checking to this code.
With best regards -
Alexander Amelkin
Zdenek Styblik
2014-05-20 19:39:56 UTC
Permalink
On Tue, May 20, 2014 at 10:05 AM, Amelkin, Aleksandr
Post by Amelkin, Aleksandr
1. Fixes incorrect behavior on FRUs without Internal Use Area (which
is allowed by the specification)
2. Corrects size calculation for Internal Use Area (finds the start of
the actual next section instead of blindly assuming that the next section is
Chasiss Info)
3. Reduces the amount of copy/pasted code and magic numbers
4. Corrects error messages to say the truth (that it couldn’t read
something) instead of spitting out false claims (that something was
“invalid”).
5. Reduces nesting level by getting rid of “while(0)/break” in favor
of simple “goto”.
Sounds good. It patches against Git tip too, which is good as well.
Post by Amelkin, Aleksandr
It’s a pity that 1.8.14 now doesn’t allow calling ‘ekanalyzer frushow
sm=<filename>’ without specifying
a full set of target options, for the aforementioned ekanalyzer command
doesn’t need them anyway and operates on a local file.
But that’s another patch, I guess. J
Another thing I would suggest to put on the ToDo list is adding checksum
checking to this code.
Feel free to do both of those. It's not like there is some corporation
pouring resources into active development of ipmitool. None that I
know of.

Regards,
Z.
Post by Amelkin, Aleksandr
With best regards –
Alexander Amelkin
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform
available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ipmitool-devel mailing list
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel
Amelkin, Aleksandr
2014-05-21 08:57:56 UTC
Permalink
Sent: Tuesday, May 20, 2014 11:40 PM
On Tue, May 20, 2014 at 10:05 AM, Amelkin, Aleksandr
Post by Amelkin, Aleksandr
...
Sounds good. It patches against Git tip too, which is good as well.
Glad you liked it. ;)
Post by Amelkin, Aleksandr
It’s a pity that 1.8.14 now doesn’t allow calling ‘ekanalyzer frushow
sm=<filename>’ without specifying a full set of target options, for
the aforementioned ekanalyzer command doesn’t need them anyway and
operates on a local file.
But that’s another patch, I guess. J
Another thing I would suggest to put on the ToDo list is adding
checksum checking to this code.
Feel free to do both of those. It's not like there is some corporation pouring
resources into active development of ipmitool. None that I know of.
Well, I can't say we as a corporation are pouring lots of resources into this as well,
but as long as we use ipmitool and fix bugs in it for our own good, and as long as
I'm in charge of that, I'm going to continue pushing the fixes upstream.

I guess I will create entries in your bug tracker to address those issues.
Actually, I already did:
https://sourceforge.net/p/ipmitool/bugs/321/
https://sourceforge.net/p/ipmitool/bugs/322/

Who knows, maybe you or anyone else will fix it before we do.
Regards,
Z.
With best regards –
Alexander Amelkin,
Head of Embedded Software Division,
R&D Department, T-Platforms
http://www.t-platf
Zdenek Styblik
2014-05-21 13:57:58 UTC
Permalink
On Wed, May 21, 2014 at 10:57 AM, Amelkin, Aleksandr
Post by Amelkin, Aleksandr
Sent: Tuesday, May 20, 2014 11:40 PM
On Tue, May 20, 2014 at 10:05 AM, Amelkin, Aleksandr
...
Sounds good. It patches against Git tip too, which is good as well.
Glad you liked it. ;)
Any improvements to that code will be welcome. I haven't reviewed your
patch thoroughly, but it seems to be sane(I did give it very quick
look on day one).

[...]
Post by Amelkin, Aleksandr
Well, I can't say we as a corporation are pouring lots of resources into this as well,
but as long as we use ipmitool and fix bugs in it for our own good, and as long as
I'm in charge of that, I'm going to continue pushing the fixes upstream.
That's pretty much what everybody else is doing, I'd say. However,
personally I think this project needs more than that. One the other
hand, if it was true, I guess things would be different.
The "message" I've received was: ``it's broken, fix it''. And it's not
just you. It seems to me like expectations of this project have
apparently shifted, which is good and bad. Good, because vendors might
be forced to invest into this project. And bad, I'd say it has shifted
beyond what I can do in my free time.
Post by Amelkin, Aleksandr
I guess I will create entries in your bug tracker to address those issues.
https://sourceforge.net/p/ipmitool/bugs/321/
https://sourceforge.net/p/ipmitool/bugs/322/
Who knows, maybe you or anyone else will fix it before we do.
I don't have access to IPMI capable HW nor have IPMI related job
anymore. Also, I'm quite struggling to find time for this project
lately. Nevertheless, it's good to have these, or any issues, logged
and be aware of bugs.
And yeah, hopefully somebody will fix it one day - be it me or
somebody else. I have this module in my sights and will try to replace
parts of the code. Hopefully, I won't break anything.

Thanks,
Z.
Post by Amelkin, Aleksandr
Regards,
Z.
With best regards –
Alexander Amelkin,
Head of Embedded Software Division,
R&D Department, T-Platforms
http://www.t-platforms.com
Tel.: +7 495 956-5490, ext. 1086
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ipmitool-devel mailing list
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel
Loading...