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

Re: [RFCv4,15/35] lib/fdt: Fix fdt_address_cell and fdt_size_cell

In the "fdt_address_cell()" description from "libfdt.h", it is specified that
this function should return "-FDT_ERR_BADNCELLS, if the node has a badly 
or invalid  #address-cells property" (similarly for "fdt_size_cells()").

Therefore, shouldn't we keep the following checks:

```if (len != sizeof(*prop))
        return -FDT_ERR_BADNCELLS;```


```int val = fdt32_to_cpu(*prop);
        if ((val <= 0) || (val > FDT_MAX_NCELLS))
                return -FDT_ERR_BADNCELLS;```

before returning the actual value (or update the description in "libfdt.h")?

Reviewed-by: Razvan Virtan <virtanrazvan@xxxxxxxxx>



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