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

RE: [PATCH v4 1/9] xen/dt: dt_property_read_string should return -ENODATA on !length


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Henry Wang <Henry.Wang@xxxxxxx>
  • Date: Fri, 1 Apr 2022 08:05:13 +0000
  • Accept-language: zh-CN, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WRN4do4qBu6wBjqe8E+nmbXoCO6sd2CBSRuXawIVIyE=; b=dr3PmMLtTS/4dOkJLZQdSpgMHfTY0R2FAMkVIIutYjZemr6N6IhGGFIaUcXOjuVAs/ony25Kt+Qi8agwRgPUcU6qC06t6eUG9ufQyZg3oiHAaMck2GjbSnQsqQd5Hr/JIy4C8DZCPZ1+yNTfvV0Db3BLBIecJMSMj41NTaRw5QISbULJ6Uk7N9wf9hBalRn90JhwVbsY8ku9CyPiI0BubB5ghxJ6qNlO0pyWc8T7onPzBbvkyRObZukCrmIKy8YiG4D22xT/G8lmvvXHeh8DqE1iGLyS/bzd192aCvlrMbdoaRBIzdBB9LHC39xniwugJyzrgxvOpRdypyLSE9sxFg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OuzDJ/lM/VkiiPYkc86/utxHKZUq67xyf2d75wUT9LD1RyJjnWN5KI4Lupg0cNOzLL2KtS7TTr4iRvQllzG1NBKE9N9r6brCkE3PxSi6IlgAsADafcb9qsDKbVySQ2Y+MYvbriMn86BtQ5CreFTcYqn6OQaQxxAztteD7GuJ99TqM8ra2NTc5AV77TrYTXTmttx7Rp3VYwr0nGBwcTOKh4lNzAMATY8GvFdfWHJXk/f+hThlX3AfxELczJgacyS2c+jXn+9MZZeuVdLpZ4PvLgK2bplcVb62QeybPYCZX6iscAOnMZqfghQw9pBAcsawCH3AlfasRDwDOKLUiy273Q==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "jgross@xxxxxxxx" <jgross@xxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "Volodymyr_Babchuk@xxxxxxxx" <Volodymyr_Babchuk@xxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
  • Delivery-date: Fri, 01 Apr 2022 08:05:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYRWD1ghazNy9i8k6ND1boTze3v6zas2fw
  • Thread-topic: [PATCH v4 1/9] xen/dt: dt_property_read_string should return -ENODATA on !length

Hi Stefano,

> -----Original Message-----
> From: Xen-devel <xen-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf Of
> Stefano Stabellini
> Sent: Friday, April 1, 2022 8:39 AM
> To: xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: sstabellini@xxxxxxxxxx; jgross@xxxxxxxx; Bertrand Marquis
> <Bertrand.Marquis@xxxxxxx>; julien@xxxxxxx;
> Volodymyr_Babchuk@xxxxxxxx; Stefano Stabellini
> <stefano.stabellini@xxxxxxxxxx>
> Subject: [PATCH v4 1/9] xen/dt: dt_property_read_string should return -
> ENODATA on !length
> 
> From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
> 
> 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 <stefano.stabellini@xxxxxxxxxx>

Reviewed-by: Henry Wang <Henry.Wang@xxxxxxx>

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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.