Commit Graph

16 Commits

Author SHA1 Message Date
Chris Johns
408dbeb922 libmisc/rtems-fdt: Support prop map items up to the size of uintptr_t
Updates #4729
2022-11-25 12:43:29 +11:00
Kinsey Moore
5b7eea631d cpukit/rtems-fdt: Avoid use of malloc/errno
Use of malloc implies errno which adds TLS dependencies and prevents use
of this FDT wrapper library in BSP initialization code. This change
makes use of rtems_malloc and rtems_calloc which avoid TLS dependencies.
2022-11-18 16:02:46 -06:00
Chris Johns
580a3a6817 libmisc/rtems-fdt: Fix return error values
Updates #4729
2022-10-14 13:43:08 +11:00
Chris Johns
fe104e399a libmisc/rtems-fdt: Fix missing error string
- Coverity CID 1515930 issue

Updates #4729
2022-10-11 12:50:30 +11:00
Chris Johns
40eb58fd5e libmisc/rtems-fdt: Update to support 64bit addresses
- Add support to get the parent address and size cells

- Provide support to get a reg prop address map

- Change getting a set of properties to uintptr_t

- Improve the debug mode of the ls command to print all props

Closes #4729
2022-10-10 11:40:55 +11:00
Kinsey Moore
3af84c1bea cpukit/fdt: Free index before container
Ensure that the index is released before the structure containing it is
freed and NULLed.

Updates #4460
2022-10-03 13:24:46 -05:00
Kinsey Moore
584f5bc9af cpukit/fdt: Check correct allocation
The second allocation check was mistakenly rechecking the first
allocation. It now checks the correct allocation and ensures that names
is not NULL.

Updates #4462
2022-10-03 13:24:46 -05:00
Joel Sherrill
c02836c485 cpukit/libmisc/rtems-fdt: Change license to BSD-2
Updates #3053.
2022-03-22 11:34:23 -05:00
Ryan Long
98ab69323e libmisc/rtems-fdt: close() file 'bf'
close() file 'bf' to avoid leaking descriptor.

CID 1437645: Resource leak in rtems_fdt_load().

Closes #4297
2021-12-17 10:27:27 -06:00
Chris Johns
4dc81f65c7 libmisc/fdt: fix node initialise error with RTEMS_DEBUG 2021-08-21 12:46:32 +10:00
G S Niteesh Babu
bd9e45d91f rtems-fdt/rtems-fdt.c: Fix bug in loop termination
The while loop, loops infinitely in case of raw FDT data.
The loop condition (size) is not modified during iterations.
2021-03-21 12:33:08 +01:00
Frank Kühndel
daeb0a1881 rtems-fdt / shell - Fix string truncation warning
The compiler warning was:

../../../cpukit/libmisc/rtems-fdt/rtems-fdt.c:267:5: warning:
'strncpy' specified bound depends on the length of the source argument
  267 |     strncpy(path, name, namelen);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

It turns out that the `strncpy()` nor the buffer `path` is needed when
one uses `strncmp()` instead of `strcmp()`. This needs some change to
the algorithm but has the advantage that `name` is never truncated
to the size of the buffer `path`.
2020-10-20 07:01:29 +02:00
Sebastian Huber
e2250eeb94 Revert "rtems-fdt / shell - Fix string truncation warning"
This reverts commit 355bc37ad3.
2020-10-16 06:22:56 +02:00
Frank Kühndel
355bc37ad3 rtems-fdt / shell - Fix string truncation warning
The compiler warning was:

../../../cpukit/libmisc/rtems-fdt/rtems-fdt.c:267:5: warning:
'strncpy' specified bound depends on the length of the source argument
  267 |     strncpy(path, name, namelen);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

It turns out that the `strncpy()` nor the buffer `path` is needed when
one uses `strncmp()` instead of `strcmp()`. This needs some change to
the algorithm but has the advantage that `name` is never truncated
to the size of the buffer `path`.

Note:

rtems-fdt.c, rtems-fdt-shell.c and cpukit/include/rtems/rtems-fdt.h
seem to be dead code. They implement a shell command `fdt` but that
command is not part of the shell nor of any macro in
cpukit/include/rtems/shellconfig.h.
2020-10-15 19:15:50 +02:00
Sebastian Huber
9ace264875 fdt: Use self-contained mutex
Update #2843.
2018-02-08 09:37:25 +01:00
Chris Johns
6b7efdb2ed libmisc/rtems-fdt: Add RTEMS FDT wrapper and shell command to libmisc.
- Provide application support for handling FDT blobs in RTEMS. This
  is useful when interfacing FPGA fabrics.
- Provide a shell command to list a blob as well as provide read
  and write access to addresses in the FTB.

Closes #3099.
2017-08-20 11:11:46 +10:00