qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/8] ipmi: fix SDR length value


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 1/8] ipmi: fix SDR length value
Date: Tue, 5 Jan 2016 12:59:40 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

On 01/05/2016 10:29 AM, Cédric Le Goater wrote:

[meta-comment] Your messages were not marked in-reply-to: the 0/8 cover
letter, but came through as separate threads.  This makes it harder to
follow, especially in mail clients that sort top-level threads by most
recent activity on the thread.

> The IPMI BMC simulator populates the SDR table with a set of initial
> SDRs. The length of each SDR is taken from the record itself (byte 4)
> which does not include the size of the header. But, the full length
> (header + data) is required by the sdr_add_entry() routine.
> 
> Signed-off-by: Cédric Le Goater <address@hidden>
> ---
> 
>  Maybe we could use a sdr struct/typedef to clarify the code. See
>  patch 7: "ipmi: introduce an ipmi_bmc_init_sensor() API"
> 
>  hw/ipmi/ipmi_bmc_sim.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
> index 0a59e539f549..559e1398d669 100644
> --- a/hw/ipmi/ipmi_bmc_sim.c
> +++ b/hw/ipmi/ipmi_bmc_sim.c
> @@ -362,7 +362,7 @@ static int sdr_find_entry(IPMISdr *sdr, uint16_t recid,
>  
>      while (pos < sdr->next_free) {
>          uint16_t trec = sdr->sdr[pos] | (sdr->sdr[pos + 1] << 8);
> -        unsigned int nextpos = pos + sdr->sdr[pos + 4];
> +        unsigned int nextpos = pos + sdr->sdr[pos + 4] + 5;

5 feels like a magic number; should you use a #define and name it?


> @@ -1709,20 +1709,20 @@ static void ipmi_sim_init(Object *obj)
>      for (i = 0;;) {
>          int len;
>          if ((i + 5) > sizeof(init_sdrs)) {
> -            error_report("Problem with recid 0x%4.4x: \n", i);
> +            error_report("Problem with recid 0x%4.4x\n", i);

Please drop the trailing \n as long as you are touching this.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]