Open AlexanderAmelkin opened 10 years ago
Original comment by: Zdenek Styblik
Hello,
I did give your patch a look. Here are the comments:
Please, give a look to http://sourceforge.net/p/ipmitool/wiki/coding_standards/
unused variables
:::C
uint8_t next_offset;
int i; /* multiple times through the diff */
fclose() ?
:::C
close(input_file);
NULL pointer after free
:::C
free(data);
data = NULL; /* missing multiple times */
Also, I must say I'd be willing to give it a shot to rewrite this code. I mean:
:::C
if (feof()) {
goto done;
}
printf(...);
if (feof()) {
goto done;
}
printf(...);
[...]
I don't mean you patch is bad, code in ipmi_ekanalyzer.c is.
Original comment by: Zdenek Styblik
Yes, code in ipmi_ekanalyzer.c is awful. I will look closer at your comments in context of my patch and will reply soon. Thank you.
Original comment by: Alexander Amelkin
One more thing I've recalled today. This didn't make sense to me, although I see it's in original code as well:
:::C
return (size_t)(-1);
Size can't be less than zero. Ok, this is wrong assumption according to http://stackoverflow.com/questions/1119370/where-do-i-find-the-definition-of-size-t However, let's assume size being 0 means error given the fact it can be either signed or unsigned int.
Original comment by: Zdenek Styblik
What a crap code!!!
Original comment by: Zdenek Styblik
Well, according to C99 size_t is unsigned, so (size_t)(-1) is a kind of oxymoron. On the other hand, if the caller performs a reverse typecast to (int), he will most probably get the actual (-1) back. Why complicate it like that is another interesting question.
Original comment by: Alexander Amelkin
according to C99 size_t is unsigned, so (size_t)(-1)
Therefore, size shoudln't be less than 0. (Yes, C99 compliance is/should be desirable). Also, it just doesn't make sense to me to have size less than zero(but hey, that's me). :)
Original comment by: Zdenek Styblik
Listen, don't worry about this one, ok? Let's get your patch in and then start with slight rewrite of the code.
Original comment by: Zdenek Styblik
How far before this gets accepted? I agree with the reported on the issues and we are seeing same problems when trying to show contents of the FMC FRU. Sadly I can not get his patches to try them out..
Original comment by: Hinko Kocevar
Hello,
why can't you download the files? What's the error you're getting? I've re-attached them just to be sure. I gave the patch quick look. If it still merges and doesn't produce more warnings, then I shouldn't be problem to get it merged. However, it would be really, really great to get rid of macros this patch brings in.
Z.
Original comment by: Zdenek Styblik
I see I had some comments there. May be author uploaded new version and didn't say he did so? This isn't clear to me :(
Z.
Original comment by: Zdenek Styblik
Original comment by: Zdenek Styblik
I'm getting : Error 403 Moderate access required
for patches in the original post. Your I was able to download your attachments.. THANKS.
Original comment by: Hinko Kocevar
After applying the patch I was unable to dump info for FMC FRU which had type/length of 0xc1 = field of one byte in length. This is because 0xc1 is also 'end-of-fields' as per storage spec and patched code was not able to cope with that.
Unpatched can properly handle this type of field.
Original comment by: Hinko Kocevar
I see. Do you plan to re-work the patch?
Original comment by: Zdenek Styblik
Here is what I can say ATM about the fixes in initial post:
For case 3. and 5. I can provide separate patches that deal with those issues separately.
Original comment by: Hinko Kocevar
Are you sure? Because it looks to me the patch did more than that.
Original comment by: Zdenek Styblik
Well the patch touched some other stuff too. Mainly formatting and some log messages IMHO. The things I can not test in that patch are Internal use area and custom mfg area parsing since I so not have suitable FRUs at hand.
Original comment by: Hinko Kocevar
Original comment by: Zdenek Styblik
Reported by: Alexander Amelkin Original Ticket: ipmitool/bugs/314
As partly mentioned in my comment to ticket #53 (https://sourceforge.net/p/ipmitool/bugs/53/#c3f8), ekanalyzer incorrectly decodes FRU data as follows:
The attached patch fixes all these issues and also cleans up the code a bit. Specifically:
There are two patches attached: