Commit Graph

10 Commits

Author SHA1 Message Date
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