[Skiboot] [PATCH 2/7] vpd: add vpd_valid() to check keyword VPD blobs

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Fri Jan 13 20:03:27 AEDT 2017


On 01/13/2017 12:26 PM, Oliver O'Halloran wrote:
> Adds a function to check whether a blob is a valid IBM ASCII keyword
> VPD blob. This allows us to recognise when we do and do not have a VPD
> blob and act accordingly.
>
> Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
> ---
>   core/vpd.c    | 26 ++++++++++++++++++++++++++
>   include/vpd.h |  2 ++
>   2 files changed, 28 insertions(+)
>
> diff --git a/core/vpd.c b/core/vpd.c
> index 505b3d639ef4..540c5578b47b 100644
> --- a/core/vpd.c
> +++ b/core/vpd.c
> @@ -46,6 +46,32 @@ const void *vpd_find_keyword(const void *rec, size_t rec_sz,
>   	return NULL;
>   }
>
> +/* vpd_valid - does some basic sanity checks to ensure a VPD blob is
> + *             actually a VPD blob
> + */
> +bool vpd_valid(const void *vvpd, size_t vpd_size)
> +{
> +	const uint8_t *vpd = vvpd;
> +	int size, i = 0;
> +
> +	/* find the record start byte */
> +	while (i < vpd_size)
> +		if (vpd[i++] == 0x84)
> +			break;

Here we have to check whether we found 0x84 or not.

-Vasant



More information about the Skiboot mailing list