 
	
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v3 1/5] xen: introduce xen,enhanced dom0less property
 Hi Stefano, On 23/03/2022 00:08, Stefano Stabellini wrote: On Sat, 29 Jan 2022, Julien Grall wrote: Thanks posting the log!For convenience, I am copying the comment on top of dt_property_read_string() prototype: * Search for a property in a device tree node and retrieve a null * terminated string value (pointer to data, not a copy). Returns 0 on * success, -EINVAL if the property does not exist, -ENODATA if property * doest not have value, and -EILSEQ if the string is not * null-terminated with the length of the property data.Per your log, the length is NULL so I would have assumed -ENODATA would be returned. Looking at the implementation: 
    const struct dt_property *pp = dt_find_property(np, propname, NULL);
    if ( !pp )
        return -EINVAL;
    if ( !pp->value )
        return -ENODATA;
    if ( strnlen(pp->value, pp->length) >= pp->length )
        return -EILSEQ;
We consider that the property when pp->value is NULL. However, AFAICT, 
we never set pp->value to NULL (see unflatten_dt_node()).So I think there is a bug in the implementation. I would keep the check !pp->value (for hardening purpose) and also return -ENODATA when !pp->length. Most of our device-tree code is from Linux. Looking at v5.17, the bug seems to be present there too. This would want to be fixed there too. Cheers, -- Julien Grall 
 
 | 
|  | Lists.xenproject.org is hosted with RackSpace, monitoring our |