<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/ipmitool.git/include/ipmitool/helper.h, branch master</title>
<subtitle>github.com: ipmitool/ipmitool.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ipmitool.git/'/>
<entry>
<title>Cast type before the left shift</title>
<updated>2022-08-28T17:23:25+00:00</updated>
<author>
<name>Tom Tung</name>
<email>shes050117@gmail.com</email>
</author>
<published>2022-08-12T07:43:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ipmitool.git/commit/?id=46fd8d942cb1e3c7bfa491c9e129b7f72de526c0'/>
<id>46fd8d942cb1e3c7bfa491c9e129b7f72de526c0</id>
<content type='text'>
Building ipmitool with UBSAN and I got:
```
...
xxx/ipmitool/include/ipmitool/helper.h:191:14: runtime error: left shift of 160
by 24 places cannot be represented in type 'int'
    #0 0x55bddaa56f11 in ipmi32toh
       xxx/ipmitool/include/ipmitool/helper.h:191:14
```

Tested: with this, I tested ipmitool again and the issue disappeared.

Resolved: ipmitool/ipmitool#352
Signed-off-by: Tom Tung &lt;shes050117@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Building ipmitool with UBSAN and I got:
```
...
xxx/ipmitool/include/ipmitool/helper.h:191:14: runtime error: left shift of 160
by 24 places cannot be represented in type 'int'
    #0 0x55bddaa56f11 in ipmi32toh
       xxx/ipmitool/include/ipmitool/helper.h:191:14
```

Tested: with this, I tested ipmitool again and the issue disappeared.

Resolved: ipmitool/ipmitool#352
Signed-off-by: Tom Tung &lt;shes050117@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Use "#pragma once" for headers</title>
<updated>2021-04-08T08:29:25+00:00</updated>
<author>
<name>Bing-Hua Wang</name>
<email>binghuawang@ami.com</email>
</author>
<published>2020-11-13T05:35:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ipmitool.git/commit/?id=5a36080f9232f4dda665202a41039aa78aa67fac'/>
<id>5a36080f9232f4dda665202a41039aa78aa67fac</id>
<content type='text'>
Some of the header guard names in ipmitool duplicated with the ones in
freeipmi.

* ipmitool/ipmi_fru.h and freeipmi/fru/ipmi-fru.h both uses IPMI_FRU_H
* ipmitool/ipmi_sdr.h and freeipmi/sdr/ipmi-sdr.h both uses IPMI_SDR_H
* ipmitool/ipmi_sel.h and freeipmi/sel/ipmi-sel.h both uses IPMI_SEL_H

This is problematic as including the 1st will prevent the 2nd from being
included, leading to the loss of any declarations, inline definitions,
or other "#includes" in the 2nd header.

For example, including ipmitool/ipmi_sel.h and freeipmi/freeipmi.h fails
to build.

$ cat test.c
 #include &lt;ipmitool/ipmi_sel.h&gt;
 #include &lt;freeipmi/freeipmi.h&gt;
$ gcc test.c -I${HOME}/src/oss/ipmitool/include
In file included from /usr/include/freeipmi/freeipmi.h:90,
                 from test.c:2:
/usr/include/freeipmi/sdr/oem/ipmi-sdr-oem-intel-node-manager.h:48:44: error: unknown type name 'ipmi_sdr_ctx_t'; did you mean 'ipmi_fru_ctx_t'?
   48 | int ipmi_sdr_oem_parse_intel_node_manager (ipmi_sdr_ctx_t ctx,
      |                                            ^~~~~~~~~~~~~~
      |                                            ipmi_fru_ctx_t

Remove header guards and use "#pragma once" instead. In this way, we
don't have to do manual management to avoid name clashes.
* src/plugins/lan/md5.h is left as is being an external header
  originally.
* src/plugins/imb/imbapi.h is a convoluted header consisting of multiple
  header guards. Let's just add "#pragma once" and leave header guards
  as is for now.

Signed-off-by: Bing-Hua Wang &lt;binghuawang@ami.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some of the header guard names in ipmitool duplicated with the ones in
freeipmi.

* ipmitool/ipmi_fru.h and freeipmi/fru/ipmi-fru.h both uses IPMI_FRU_H
* ipmitool/ipmi_sdr.h and freeipmi/sdr/ipmi-sdr.h both uses IPMI_SDR_H
* ipmitool/ipmi_sel.h and freeipmi/sel/ipmi-sel.h both uses IPMI_SEL_H

This is problematic as including the 1st will prevent the 2nd from being
included, leading to the loss of any declarations, inline definitions,
or other "#includes" in the 2nd header.

For example, including ipmitool/ipmi_sel.h and freeipmi/freeipmi.h fails
to build.

$ cat test.c
 #include &lt;ipmitool/ipmi_sel.h&gt;
 #include &lt;freeipmi/freeipmi.h&gt;
$ gcc test.c -I${HOME}/src/oss/ipmitool/include
In file included from /usr/include/freeipmi/freeipmi.h:90,
                 from test.c:2:
/usr/include/freeipmi/sdr/oem/ipmi-sdr-oem-intel-node-manager.h:48:44: error: unknown type name 'ipmi_sdr_ctx_t'; did you mean 'ipmi_fru_ctx_t'?
   48 | int ipmi_sdr_oem_parse_intel_node_manager (ipmi_sdr_ctx_t ctx,
      |                                            ^~~~~~~~~~~~~~
      |                                            ipmi_fru_ctx_t

Remove header guards and use "#pragma once" instead. In this way, we
don't have to do manual management to avoid name clashes.
* src/plugins/lan/md5.h is left as is being an external header
  originally.
* src/plugins/imb/imbapi.h is a convoluted header consisting of multiple
  header guards. Let's just add "#pragma once" and leave header guards
  as is for now.

Signed-off-by: Bing-Hua Wang &lt;binghuawang@ami.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mc: Fix reporting of manufacturers &gt; 64K</title>
<updated>2019-06-18T17:07:57+00:00</updated>
<author>
<name>Alexander Amelkin</name>
<email>alexander@amelkin.msk.ru</email>
</author>
<published>2019-06-18T16:51:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ipmitool.git/commit/?id=d95775288d41d13e07902f2cf1e11386d1185458'/>
<id>d95775288d41d13e07902f2cf1e11386d1185458</id>
<content type='text'>
If a manufacturer's IANA PEN (aka manufacturer ID) was above
65535, it wasn't reported properly. Luckily there are no such
IDs so far, the biggest is 54077 as of 2019/06/18.

There is, however, an ID 0xFFFFFE used by fake_ipmistack
for debug purposes, and it was not reported correctly.

This commit expands the value argument to string searching functions
from 16-bit to 32-bit to allow for any possible IANA PEN.

Fixes: 73d6af57827fc85e78c700ca1dff00b3dbc63948
Signed-off-by: Alexander Amelkin &lt;alexander@amelkin.msk.ru&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If a manufacturer's IANA PEN (aka manufacturer ID) was above
65535, it wasn't reported properly. Luckily there are no such
IDs so far, the biggest is 54077 as of 2019/06/18.

There is, however, an ID 0xFFFFFE used by fake_ipmistack
for debug purposes, and it was not reported correctly.

This commit expands the value argument to string searching functions
from 16-bit to 32-bit to allow for any possible IANA PEN.

Fixes: 73d6af57827fc85e78c700ca1dff00b3dbc63948
Signed-off-by: Alexander Amelkin &lt;alexander@amelkin.msk.ru&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Add support for command-specific completion codes</title>
<updated>2019-06-10T10:56:31+00:00</updated>
<author>
<name>Alexander Amelkin</name>
<email>alexander@amelkin.msk.ru</email>
</author>
<published>2019-05-30T13:05:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ipmitool.git/commit/?id=73d6af57827fc85e78c700ca1dff00b3dbc63948'/>
<id>73d6af57827fc85e78c700ca1dff00b3dbc63948</id>
<content type='text'>
Some commands may return command-specific completion codes.
Now they are all reported as 'Unknown'.
Add helper functions to support such command-specific codes.
Command handlers will need to define their own valstr arrays
with completion code descriptions and then use specific_val2str()
instead of generic val2str() to convert the completion code into
a string.

Also reduce code duplication in helper.c

Signed-off-by: Alexander Amelkin &lt;alexander@amelkin.msk.ru&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some commands may return command-specific completion codes.
Now they are all reported as 'Unknown'.
Add helper functions to support such command-specific codes.
Command handlers will need to define their own valstr arrays
with completion code descriptions and then use specific_val2str()
instead of generic val2str() to convert the completion code into
a string.

Also reduce code duplication in helper.c

Signed-off-by: Alexander Amelkin &lt;alexander@amelkin.msk.ru&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Add a helper htoipmi24() function</title>
<updated>2019-06-10T10:56:31+00:00</updated>
<author>
<name>Alexander Amelkin</name>
<email>alexander@amelkin.msk.ru</email>
</author>
<published>2019-05-27T17:07:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ipmitool.git/commit/?id=c9510635d777c6d231dbca91af527bd3afdafdd7'/>
<id>c9510635d777c6d231dbca91af527bd3afdafdd7</id>
<content type='text'>
The function converts a host 32-bit integer into an IPMI
24-bit value (LSB first).

Signed-off-by: Alexander Amelkin &lt;alexander@amelkin.msk.ru&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The function converts a host 32-bit integer into an IPMI
24-bit value (LSB first).

Signed-off-by: Alexander Amelkin &lt;alexander@amelkin.msk.ru&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Add a helper args2buf() function</title>
<updated>2019-06-10T10:56:31+00:00</updated>
<author>
<name>Alexander Amelkin</name>
<email>alexander@amelkin.msk.ru</email>
</author>
<published>2019-05-27T17:05:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ipmitool.git/commit/?id=e11f463b4ea988dfe4314b2fd3d9c91315f10965'/>
<id>e11f463b4ea988dfe4314b2fd3d9c91315f10965</id>
<content type='text'>
The function converts a set of command line arguments representing
byte values into a byte buffer and verifies each individual value
to be a valid data byte.

Signed-off-by: Alexander Amelkin &lt;alexander@amelkin.msk.ru&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The function converts a set of command line arguments representing
byte values into a byte buffer and verifies each individual value
to be a valid data byte.

Signed-off-by: Alexander Amelkin &lt;alexander@amelkin.msk.ru&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Refactor free_n() function</title>
<updated>2019-02-20T11:56:37+00:00</updated>
<author>
<name>Alexander Amelkin</name>
<email>alexander@amelkin.msk.ru</email>
</author>
<published>2019-02-20T11:56:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ipmitool.git/commit/?id=08348f1b72de27681549894f7a506674fba19ff2'/>
<id>08348f1b72de27681549894f7a506674fba19ff2</id>
<content type='text'>
Make the argument to free_n() compatible with any pointers,
thus reducing the number of compilation warnings.

End-user-impact: None
Signed-off-by: Alexander Amelkin &lt;alexander@amelkin.msk.ru&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make the argument to free_n() compatible with any pointers,
thus reducing the number of compilation warnings.

End-user-impact: None
Signed-off-by: Alexander Amelkin &lt;alexander@amelkin.msk.ru&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>helper: add free_n method to handle clearing pointers</title>
<updated>2018-12-24T16:17:48+00:00</updated>
<author>
<name>Patrick Venture</name>
<email>venture@google.com</email>
</author>
<published>2018-12-05T16:55:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ipmitool.git/commit/?id=8b6d127bb14b9ad7ef28da1fc5f8c965df2123cd'/>
<id>8b6d127bb14b9ad7ef28da1fc5f8c965df2123cd</id>
<content type='text'>
free_n() will free the memory and clear the pointer, which will reduce
the probability a developer will forget to clear the pointer after
freeing.

Resolves: #79

Signed-off-by: Patrick Venture &lt;venture@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
free_n() will free the memory and clear the pointer, which will reduce
the probability a developer will forget to clear the pointer after
freeing.

Resolves: #79

Signed-off-by: Patrick Venture &lt;venture@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>implement __UNUSED__ macro for marking unused</title>
<updated>2018-11-23T13:41:06+00:00</updated>
<author>
<name>Patrick Venture</name>
<email>venture@google.com</email>
</author>
<published>2018-11-20T17:14:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ipmitool.git/commit/?id=9a55136bfb67d8257d2d896df677a725180d88ef'/>
<id>9a55136bfb67d8257d2d896df677a725180d88ef</id>
<content type='text'>
Implement __UNUSED__ macro for marking symbols unused safely.

Partially resolves ipmitool/ipmitool#13

Signed-off-by: Patrick Venture &lt;venture@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Implement __UNUSED__ macro for marking symbols unused safely.

Partially resolves ipmitool/ipmitool#13

Signed-off-by: Patrick Venture &lt;venture@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>strings: Refix 329ebdff: Enlarge data type</title>
<updated>2018-08-21T15:18:07+00:00</updated>
<author>
<name>Alexander Amelkin</name>
<email>alexander@amelkin.msk.ru</email>
</author>
<published>2018-08-21T15:18:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ipmitool.git/commit/?id=03d2b53c97f7c126af7c6b22e052204f1808d43c'/>
<id>03d2b53c97f7c126af7c6b22e052204f1808d43c</id>
<content type='text'>
Make val in valstr 32-bit to accomodate the values added
by commit 329ebdff.

Signed-off-by: Alexander Amelkin &lt;alexander@amelkin.msk.ru&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make val in valstr 32-bit to accomodate the values added
by commit 329ebdff.

Signed-off-by: Alexander Amelkin &lt;alexander@amelkin.msk.ru&gt;
</pre>
</div>
</content>
</entry>
</feed>
