[PATCH ipmi-fru-parser] Increase size of buffer length variable

Adriana Kobylak anoo at us.ibm.com
Fri May 13 23:51:31 AEST 2016


The size of size_t is different in 32 and 64-bit architectures. There has 
been issues in the past in op-build where we had to change size_t to 
uint32_t to support compiling in 64-bit. So thought I'd make the change 
consistent and change the length to uint32_t.


From:   Daniel Axtens <notifications at github.com>
To:     openbmc/ipmi-fru-parser <ipmi-fru-parser at noreply.github.com>
Cc:     Adriana Kobylak/Austin/IBM at IBMUS, Author 
<author at noreply.github.com>
Date:   05/12/2016 06:16 PM
Subject:        Re: [openbmc/ipmi-fru-parser] Increase size of buffer 
length variable (#15)



In frup.c:
> @@ -948,7 +948,7 @@ parse_fru (const void* msgbuf, sd_bus_message* 
vpdtbl)
>    return (rv);
>  }
> 
> -int parse_fru_area (const uint8_t area, const void* msgbuf, const 
uint8_t len, sd_bus_message* vpdtbl)
> +int parse_fru_area (const uint8_t area, const void* msgbuf, const 
uint32_t len, sd_bus_message* vpdtbl)

Is there any reason we couldn't standardise on size_t here?



OpenBMC Patches <openbmc-patches at stwcx.xyz> wrote on 05/12/2016 02:10:19 
PM:

> From: OpenBMC Patches <openbmc-patches at stwcx.xyz>
> To: openbmc at lists.ozlabs.org
> Cc: Adriana Kobylak/Austin/IBM at IBMUS
> Date: 05/12/2016 02:10 PM
> Subject: [PATCH ipmi-fru-parser] Increase size of buffer length variable
> 
> From: Adriana Kobylak <anoo at us.ibm.com>
> 
> The latest Barreleye vpd contains additional custom fields in one
> of the board sections, pushing the size of the buffer over 0x100.
> 
> The current variable that stores the buffer size is set to be
> uint8_t which doesn't fit the extended size. Changing it to uint32_t.
> 
> Signed-off-by: Adriana Kobylak <anoo at us.ibm.com>
> ---
>  fru-area.H | 4 ++--
>  frup.c     | 2 +-
>  frup.h     | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fru-area.H b/fru-area.H
> index 82206bb..058e438 100644
> --- a/fru-area.H
> +++ b/fru-area.H
> @@ -26,7 +26,7 @@ class ipmi_fru
>          std::string iv_name;
> 
>          // Length of a specific fru area.
> -        size_t  iv_len;
> +        uint32_t  iv_len;
> 
>          // Special bit for BMC readable eeprom only.
>          bool iv_bmc_fru;
> @@ -94,7 +94,7 @@ class ipmi_fru
>          }
> 
>          // Returns the length.
> -        size_t get_len() const
> +        uint32_t get_len() const
>          {
>              return iv_len;
>          }
> diff --git a/frup.c b/frup.c
> index 7bdf35f..4df7266 100644
> --- a/frup.c
> +++ b/frup.c
> @@ -948,7 +948,7 @@ parse_fru (const void* msgbuf, sd_bus_message* 
vpdtbl)
>    return (rv);
>  }
> 
> -int parse_fru_area (const uint8_t area, const void* msgbuf, const 
> uint8_t len, sd_bus_message* vpdtbl)
> +int parse_fru_area (const uint8_t area, const void* msgbuf, const 
> uint32_t len, sd_bus_message* vpdtbl)
>  {
>    int ret = 0;
>    int rv = -1;
> diff --git a/frup.h b/frup.h
> index 8400951..094d223 100644
> --- a/frup.h
> +++ b/frup.h
> @@ -10,7 +10,7 @@ extern "C"
> 
>  /* Parse an IPMI write fru data message into a dictionary 
> containing name value pair of VPD entries.*/
>  int parse_fru (const void* msgbuf, sd_bus_message* vpdtbl);
> -int parse_fru_area (const uint8_t area, const void* msgbuf, const 
> uint8_t len, sd_bus_message* vpdtbl);
> +int parse_fru_area (const uint8_t area, const void* msgbuf, const 
> uint32_t len, sd_bus_message* vpdtbl);
> 
>  #ifdef __cplusplus
>  }
> -- 
> 2.8.1
> 
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20160513/75292b3e/attachment-0001.html>


More information about the openbmc mailing list