All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@fr.ibm.com>
To: Eric Blake <eblake@redhat.com>, Corey Minyard <cminyard@mvista.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/8] ipmi: fix SDR length value
Date: Wed, 6 Jan 2016 09:14:53 +0100	[thread overview]
Message-ID: <568CCCFD.9030402@fr.ibm.com> (raw)
In-Reply-To: <568C20AC.3020805@redhat.com>

On 01/05/2016 08:59 PM, Eric Blake wrote:
> 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.

Yes. My bad. I put 'thread = false' in my .gitconfig for some reason and
didn't check before sending. This is fixed.

>> 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 <clg@fr.ibm.com>
>> ---
>>
>>  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?

Yes. 5 being the sdr header length. 

The simulator uses a lot of these byte offsets and I think the code 
would gain to use a struct as proposed in patch 7: 
  
  "ipmi: introduce an ipmi_bmc_init_sensor() API". 

Corey, is there a reason for not doing so ? 

>> @@ -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.

Sure.

Thanks,

C.
 

  reply	other threads:[~2016-01-06  8:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05 17:29 [Qemu-devel] [PATCH 1/8] ipmi: fix SDR length value Cédric Le Goater
2016-01-05 19:59 ` Eric Blake
2016-01-06  8:14   ` Cédric Le Goater [this message]
2016-01-08 20:20     ` Corey Minyard
2016-01-12  8:09       ` Cédric Le Goater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=568CCCFD.9030402@fr.ibm.com \
    --to=clg@fr.ibm.com \
    --cc=cminyard@mvista.com \
    --cc=eblake@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.