summaryrefslogtreecommitdiffstats
path: root/cpukit/dtc (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Update company nameSebastian Huber2023-05-201-1/+1
| | | | | The embedded brains GmbH & Co. KG is the legal successor of embedded brains GmbH.
* dtc: Update VERSIONSebastian Huber2022-12-221-10/+18
|
* libfdt: prevent integer overflow in fdt_next_tagTadeusz Struk2022-12-221-5/+12
| | | | | | | | | | | | Since fdt_next_tag() in a public API function all input parameters, including the fdt blob should not be trusted. It is possible to forge a blob with invalid property length that will cause integer overflow during offset calculation. To prevent that, validate the property length read from the blob before doing calculations. Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org> Message-Id: <20221005232931.3016047-1-tadeusz.struk@linaro.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libdtc: remove duplicate judgmentsJia Xianhua2022-12-221-3/+0
| | | | | | | | There is no need to check the VALID_DTB repeatedly, and can be combined into one if statement. Signed-off-by: Jia Xianhua <jiaxianhua@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* dtc: Update VERSIONSebastian Huber2022-07-191-5/+12
|
* Fix a UB when fdt_get_string return nullLoveSy2022-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | When fdt_get_string return null, `namep` is not correctly reset. From the document of `fdt_getprop_by_offset`, the parameter `namep` will be always overwritten (that is, it will be overwritten without exception of error occurance). As for the caller (like https://github.com/topjohnwu/Magisk/blob/e097c097feb881f6097b6d1dc346f310bc92f5d6/native/jni/magiskboot/dtb.cpp#L42), the code may be like: ```cpp size_t size; const char *name; auto *value = fdt_getprop_by_offset(fdt, prop, &name, &size); ``` and if `value == nullptr`, `size` is also be overwritten correctly but `name` is not, which is quite inconsistent. This commit makes sure `name` and `size` behavior consistently (reset to reasonable value) when error occurs. Signed-off-by: LoveSy <shana@zju.edu.cn> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* dtc: Update VERSIONSebastian Huber2021-12-141-3/+3
|
* libfdt: fix an incorrect integer promotionElvira Khabirova2021-12-141-1/+1
| | | | | | | | | | UINT32_MAX is an integer of type unsigned int. UINT32_MAX + 1 overflows unless explicitly computed as unsigned long long. This led to some invalid addresses being treated as valid. Cast UINT32_MAX to uint64_t explicitly. Signed-off-by: Elvira Khabirova <e.khabirova@omp.ru>
* libfdt: Add ALIGNMENT error stringGeorg Kotheimer2021-12-141-0/+1
| | | | | | | | The ALIGNMENT error was missing a string, leading to <unknown error> being returned. Signed-off-by: Georg Kotheimer <georg.kotheimer@kernkonzept.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Fix CID 1461557David Gibson2021-12-141-5/+8
| | | | | | | | | | | | Coverity gets a bit confused by loading fdt_size_dt_strings() and using it in a memmove(). In fact this is safe because the callers have verified this information (via FDT_RW_PROBE() in fdt_pack() or construction in fdt_open_into()). Passing in strings_size like we already do struct_size seems to get Coverity to follow what's going on here. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add FDT alignment check to fdt_check_header()Rob Herring2021-12-141-0/+4
| | | | | | | | | | | | | Only checking the FDT alignment in fdt_ro_probe_() means that fdt_check_header() can pass, but then subsequent API calls fail on alignment checks. Let's add an alignment check to fdt_check_header() so alignment errors are found up front. Cc: Tom Rini <trini@konsulko.com> Cc: Frank Rowand <frowand.list@gmail.com> Signed-off-by: Rob Herring <robh@kernel.org> Message-Id: <20210406190712.2118098-1-robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Fix a possible "unchecked return value" warningDavid Gibson2021-12-141-1/+4
| | | | | | | | | | | | | | | | Apparently the unchecked return value of the first fdt_next_tag() call in fdt_add_subnode_namelen() is tripping Coverity Scan in some circumstances, although it appears not to for the scan on our project itself. This fdt_next_tag() should always return FDT_BEGIN_NODE, since otherwise the fdt_subnode_offset_namelen() above would have returned BADOFFSET or BADSTRUCTURE. Still, add a check to shut Coverity up, gated by a can_assume() to avoid bloat in small builds. Reported-by: Ryan Long <ryan.long@oarcorp.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Set last_comp_version correctly in new dtb and fix potential version issues ↵Justin Covell2021-12-142-2/+4
| | | | | | | | | | | | | | | in fdt_open_into Changes in v3: - Remove noop version sets - Set version correctly on loaded fdt in fdt_open_into Fixes: f1879e1a50eb ("Add limited read-only support for older (V2 and V3) device tree to libfdt.") Signed-off-by: Justin Covell <jujugoboom@gmail.com> Message-Id: <20201229041749.2187-1-jujugoboom@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Tweak description of assume-aligned load helpersDavid Gibson2021-12-141-7/+7
| | | | | | | | There's a small inaccuracy in the comment describing these new helpers. This corrects it, and reformats while we're there. Fixes: f98f28ab ("libfdt: Internally perform potentially unaligned loads") Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Internally perform potentially unaligned loadsTom Rini2021-12-142-10/+29
| | | | | | | | | | | | | | | | | | | | | Commits 6dcb8ba4 "libfdt: Add helpers for accessing unaligned words" introduced changes to support unaligned reads for ARM platforms and 11738cf01f15 "libfdt: Don't use memcpy to handle unaligned reads on ARM" improved the performance of these helpers. On further discussion, while there are potential cases where we could be used on platforms that do not fixup unaligned reads for us, making this choice the default is very expensive in terms of binary size and access time. To address this, introduce and use new fdt{32,64}_ld_ functions that call fdt{32,64}_to_cpu() as was done prior to the above mentioned commits. Leave the existing load functions as unaligned-safe and include comments in both cases. Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Tom Rini <trini@konsulko.com> Message-Id: <20201211022736.31657-1-trini@konsulko.com> Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Check for 8-byte address alignment in fdt_ro_probe_()Tom Rini2021-12-141-0/+4
| | | | | | | | | | The device tree must be loaded in to memory at an 8-byte aligned address. Add a check for this condition in fdt_ro_probe_() and a new error code to return if we are not. Signed-off-by: Tom Rini <trini@konsulko.com> Message-Id: <20201104130605.28874-1-trini@konsulko.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fdt_strerror(): Fix comparison warningAndre Przywara2021-12-141-2/+2
| | | | | | | | | | | | | With -Wsign-compare, compilers warn about a mismatching signedness in a comparison in fdt_strerror(). Force FDT_ERRTABSIZE to be signed (it's surely small enough to fit), so that the types match. Also move the minus sign to errval, as this is actually what we use in the next line. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20201001164630.4980-7-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fdt_get_string(): Fix sequential write comparison warningsAndre Przywara2021-12-141-4/+6
| | | | | | | | | | | | | With -Wsign-compare, compilers warn about a mismatching signedness in comparisons in fdt_get_string(). Introduce a new usigned variable, which holds the actual (negated) stroffset value, so we avoid negating all the other variables and have proper types everywhere. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20201001164630.4980-6-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: libfdt_wip: Fix comparison warningAndre Przywara2021-12-141-1/+1
| | | | | | | | | | | | | With -Wsign-compare, compilers warn about a mismatching signedness in a comparison in fdt_setprop_inplace_namelen_partial(). fdt_getprop_namelen() will only return negative error values in "proplen" if the return value is NULL. So we can rely on "proplen" being positive in our case and can safely cast it to an unsigned type. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20201001164630.4980-5-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fdt_create_with_flags(): Fix comparison warningAndre Przywara2021-12-141-2/+2
| | | | | | | | | | | | With -Wsign-compare, compilers warn about a mismatching signedness in a comparison in fdt_create_with_flags(). By making hdrsize a signed integer (we are sure it's a very small number), we avoid all the casts and have matching types. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20201001164630.4980-4-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fdt_move(): Fix comparison warningsAndre Przywara2021-12-141-1/+4
| | | | | | | | | | | | | | | With -Wsign-compare, compilers warn about a mismatching signedness in comparisons in fdt_move(). This stems from "bufsize" being passed in as a signed integer, even though we would expect a buffer size to be positive. Short of changing the prototype, check that bufsize is not negative, and cast it to an unsigned type in the comparison. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20201001164630.4980-3-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fdt_add_string_(): Fix comparison warningAndre Przywara2021-12-141-7/+7
| | | | | | | | | | | | With -Wsign-compare, compilers warn about a mismatching signedness in a comparison in fdt_add_string_(). Make all variables unsigned, and express the negative offset trick via subtractions in the code. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20201001164630.4980-2-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fdt_node_offset_by_phandle(): Fix comparison warningAndre Przywara2021-12-141-1/+1
| | | | | | | | | | | | With -Wsign-compare, compilers warn about a mismatching signedness in a comparison in fdt_node_offset_by_phandle(). Uses a better suited bitwise NOT operator to denote the special value of -1, which automatically results in an unsigned type. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20200921165303.9115-14-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fdt_resize(): Fix comparison warningAndre Przywara2021-12-141-1/+4
| | | | | | | | | | | | | | With -Wsign-compare, compilers warn about a mismatching signedness in a comparison in fdt_resize(). A negative buffer size will surely do us no good, so let's rule this case out first. In the actual comparison we then know that a cast to an unsigned type is safe. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20200921165303.9115-10-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fdt_splice_(): Fix comparison warningAndre Przywara2021-12-141-1/+1
| | | | | | | | | | | | With -Wsign-compare, compilers warn about a mismatching signedness in a comparison in fdt_splice_(). Since we just established that oldlen is not negative, we can safely cast it to an unsigned type. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20200921165303.9115-8-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fdt_get_string(): Fix comparison warningsSimon Glass2021-12-141-2/+2
| | | | | | | | | | | | | With -Wsign-compare, compilers warn about a mismatching signedness in comparisons in fdt_get_string(). In the first two cases, we have just established that the signed values are not negative, so it's safe to cast the values to an unsigned type. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20200921165303.9115-7-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fdt_grab_space_(): Fix comparison warningAndre Przywara2021-12-141-2/+2
| | | | | | | | | | | | With -Wsign-compare, compilers warn about a mismatching signedness in a comparison in fdt_grab_space_(). All the involved values cannot be negative, so let's switch the types of the local variables to unsigned to make the compiler happy. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20200921165303.9115-4-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fdt_mem_rsv(): Fix comparison warningsAndre Przywara2021-12-141-2/+2
| | | | | | | | | | | | With -Wsign-compare, compilers warn about a mismatching signedness in comparisons in fdt_mem_rsv(). Since all involved values must be positive, change the used types to be unsigned. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20200921165303.9115-3-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fdt_offset_ptr(): Fix comparison warningsAndre Przywara2021-12-141-3/+7
| | | | | | | | | | | | | | | With -Wsign-compare, compilers warn about mismatching signedness in comparisons in fdt_offset_ptr(). This mostly stems from "offset" being passed in as a signed integer, even though the function would not really tolerate negative values. Short of changing the prototype, check that offset is not negative, and use an unsigned type internally. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20200921165303.9115-2-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fix fdt_check_node_offset_ w/ VALID_INPUTFrank Mehnert2021-12-141-6/+10
| | | | | | | | | | | | | fdt_check_node_offset_() checks for a valid offset but also changes the offset by calling fdt_next_tag(). Hence, do not skip this function if ASSUME_VALID_INPUT is set but only omit the initial offset check in that case. As this function works very similar to fdt_check_prop_offset_(), do the offset check there as well depending on ASSUME_VALID_INPUT. Message-Id: <1913141.TlUzK5foHS@noys4> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: trivial typo fixPatrick Oppenlander2021-12-141-1/+1
| | | | | | Signed-off-by: Patrick Oppenlander <patrick.oppenlander@gmail.com> Message-Id: <20200618042117.131731-1-patrick.oppenlander@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Correct condition for reordering blocksSimon Glass2021-12-141-1/+1
| | | | | | | | | This condition uses bitwise OR but should be logical OR. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: kernel test robot <lkp@intel.com> Message-Id: <20200615160033.87328-1-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fix undefined behaviour in fdt_splice_()Jan Beulich2021-12-141-6/+7
| | | | | | | | | | | | | | libfdt: fix undefined behaviour in fdt_splice_() Along the lines of commit d0b3ab0a0f46 ("libfdt: Fix undefined behaviour in fdt_offset_ptr()"), fdt_splice_() similarly may not use pointer arithmetic to do overflow checks. (The left side of the checks added by d4c7c25c9ed1 ["libfdt: check for potential overrun in _fdt_splice()"] doesn't really lend itself to similar replacement though.) Signed-off-by: Jan Beulich <jbeulich@suse.com> Message-Id: <f2d09e81-7cb8-c5cc-9699-1ac05b0626ff@suse.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Use VALID_INPUT for FDT_ERR_BADSTATE checksSimon Glass2021-12-142-4/+5
| | | | | | | | | | This error indicates a logic bug in the code calling libfdt, so VALID_DTB is not really the right check. Update it to use VALID_INPUT instead. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20200302190255.51426-4-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add support for disabling internal checksSimon Glass2021-12-142-2/+11
| | | | | | | | | | | If libfdt returns -FDT_ERR_INTERNAL that generally indicates a bug in the library. Add a new assumption for these cases since it should be save to disable these checks regardless of the input. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20200302190255.51426-3-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Improve comments in some of the assumptionsSimon Glass2021-12-141-3/+12
| | | | | | | | | Add a little more detail in a few of these comments. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20200302190255.51426-2-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Fix a few typosSimon Glass2021-12-141-3/+3
| | | | | | | | | | Fix 'saftey' and 'additional' typos noticed in the assumption series. Reword the ASSUME_NO_ROLLBACK slightly to improve clarity. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20200302190255.51426-1-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* dtc: Update VERSIONSebastian Huber2020-03-021-3/+3
|
* libfdt: Allow exclusion of fdt_check_full()Simon Glass2020-03-021-63/+0
| | | | | | | | | | This function is used to perform a full check of the device tree. Allow it to be excluded if all assumptions are enabled. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20200220214557.176528-9-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add support for disabling ordering check/fixupSimon Glass2020-03-021-1/+2
| | | | | | | | | | Add a way to remove this check and the reordering code, which is unnecessary if the dtb is known to be correctly ordered. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20200220214557.176528-8-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add support for disabling version checksSimon Glass2020-03-023-24/+32
| | | | | | | | | Allow enabling FDT_ASSUME_LATEST to disable version checks. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20200220214557.176528-7-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add support for disabling rollback handlingSimon Glass2020-03-021-3/+15
| | | | | | | | | | Allow enabling FDT_ASSUME_NO_ROLLBACK to disable rolling back after a failed operation. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20200220214557.176528-6-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add support for disabling sanity checksSimon Glass2020-03-022-24/+48
| | | | | | | | | | Allow enabling ASSUME_VALID_INPUT to disable sanity checks on the device tree and the parameters to libfdt. This assumption covers that cases where the problem could be with either. Signed-off-by: Simon Glass <sjg@chromium.org> Message-Id: <20200220214557.176528-5-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add support for disabling dtb checksSimon Glass2020-03-024-29/+45
| | | | | | | | | | | Support ASSUME_VALID_DTB to disable some sanity checks If we assume that the DTB itself is valid then we can skip some checks and save code space. Add various conditions to handle this. Signed-off-by: Simon Glass <sjg@chromium.org> Message-Id: <20200220214557.176528-4-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Add a way to control the level of checks in the codeSimon Glass2020-03-021-0/+104
| | | | | | | | | | | | | Add a new ASSUME_MASK option, which allows for some control over the checks used in libfdt. With all assumptions enabled, libfdt assumes that the input data and parameters are all correct and that internal errors cannot happen. By default no assumptions are made and all checks are enabled. Signed-off-by: Simon Glass <sjg@chromium.org> Message-Id: <20200220214557.176528-3-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: De-inline fdt_header_size()Simon Glass2020-03-021-0/+5
| | | | | | | | | | | There does not seem to be a strong reason to inline this function. Also we are about to add some extra code to it which will increase its size. Move it into fdt.c and use a simple declaration in libfdt.h Signed-off-by: Simon Glass <sjg@chromium.org> Message-Id: <20200220214557.176528-2-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Correct prototype for fdt_ro_probe_()David Gibson2020-03-021-2/+2
| | | | | | | | | | | This function returns an int32_t, however the prototype in libfdt_internal.h shows it returning an int. We haven't caught this before because they're the same type on nearly all platforms this gets built on. Apparently it's not the case on FreeRTOS, so someone hit this mismatch building for that platform. Reported-by: dharani kumar <dharanikumarsrvn@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Allow #size-cells of 0David Gibson2020-03-021-3/+5
| | | | | | | | | | | | | | | | | | c12b2b0c20eb "libfdt: fdt_address_cells() and fdt_size_cells()" introduced a bug as it consolidated code between the helpers for getting #address-cells and #size-cells. Specifically #size-cells is allowed to be 0, and is frequently found so in practice for /cpus. IEEE1275 only requires implementations to handle 1..4 for #address-cells, although one could make a case for #address-cells == #size-cells == 0 being used to represent a bridge with a single port. While we're there, it's not totally obvious that the existing implicit cast of a u32 to int will give the correct results according to strict C, although it does work in practice. Straighten that up to cast only after we've made our range checks. Reported-by: yonghuhaige via https://github.com/dgibson/dtc/issues/28 Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Tweak data handling to satisfy CoverityDavid Gibson2020-03-023-12/+18
| | | | | | | | | | | | | | | | | | | | | | | In libfdt we often sanity test fdt_totalsize(fdt) fairly early, then trust it (but *only* that header field) for the remainder of our work. However, Coverity gets confused by this - it sees the byteswap in fdt32_ld() and assumes that means it is coming from an untrusted source everytime, resulting in many tainted data warnings. Most of these end up with logic in fdt_get_string() as the unsafe destination for this tainted data, so let's tweak the logic there to make it clearer to Coverity that this is ok. We add a sanity test on fdt_totalsize() to fdt_probe_ro_(). Because the interface allows bare ints to be used for offsets, we already have the assumption that totalsize must be 31-bits or less (2GiB would be a ludicrously large fdt). This makes this more explicit. We also make fdt_probe_ro() return the size for convenience, and change the logic in fdt_get_string() to keep it in a local so that Coverity can see that it has already been bounds-checked. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Replace GPL/BSD boilerplate/reference with SPDX tagsRob Herring2020-03-029-413/+9
| | | | | | | | Replace instances of dual GPLv2 or BSD license boilerplate with SPDX tags. Signed-off-by: Rob Herring <robh@kernel.org> Message-Id: <20190620211944.9378-3-robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>