Hi Stefano,

> -----Original Message-----
> From: Xen-devel <[email protected]> On Behalf Of
> Stefano Stabellini
> Sent: Friday, April 1, 2022 8:39 AM
> To: [email protected]
> Cc: [email protected]; [email protected]; Bertrand Marquis
> <[email protected]>; [email protected];
> [email protected]; Stefano Stabellini
> <[email protected]>
> Subject: [PATCH v4 1/9] xen/dt: dt_property_read_string should return -
> ENODATA on !length
> 
> From: Stefano Stabellini <[email protected]>
> 
> When the length is zero (pp->length == 0), dt_property_read_string
> should return -ENODATA, but actually currently returns -EILSEQ because
> there is no specific check for lenght == 0.
> 
> Add a check now.
> 
> Signed-off-by: Stefano Stabellini <[email protected]>

Reviewed-by: Henry Wang <[email protected]>

> ---
>  xen/common/device_tree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> index 4aae281e89..db67fb5fb4 100644
> --- a/xen/common/device_tree.c
> +++ b/xen/common/device_tree.c
> @@ -198,7 +198,7 @@ int dt_property_read_string(const struct
> dt_device_node *np,
> 
>      if ( !pp )
>          return -EINVAL;
> -    if ( !pp->value )
> +    if ( !pp->value || !pp->length )
>          return -ENODATA;
>      if ( strnlen(pp->value, pp->length) >= pp->length )
>          return -EILSEQ;
> --
> 2.25.1
> 


Reply via email to