source: rtems/cpukit/sapi/src/fatalsrctext.c @ de9b7d7

5
Last change on this file since de9b7d7 was de9b7d7, checked in by Sebastian Huber <sebastian.huber@…>, on 06/01/18 at 05:04:45

Add RTEMS_FATAL_SOURCE_INVALID_HEAP_FREE

An invalid heap usage such as a double free is usually a fatal error
since this indicates a use after free. Replace the use of printk() in
free() with a fatal error.

Update #3437.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * @file
3 *
4 * @brief Implementation of rtems_fatal_source_text()
5 *
6 * @ingroup ClassicFatal
7 */
8
9/*
10 * Copyright (c) 2013, 2018 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Dornierstr. 4
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#if HAVE_CONFIG_H
24  #include "config.h"
25#endif
26
27#include <rtems/fatal.h>
28
29static const char *const fatal_source_text[] = {
30  "INTERNAL_ERROR_CORE",
31  "INTERNAL_ERROR_RTEMS_API",
32  "INTERNAL_ERROR_POSIX_API",
33  "RTEMS_FATAL_SOURCE_BDBUF",
34  "RTEMS_FATAL_SOURCE_APPLICATION",
35  "RTEMS_FATAL_SOURCE_EXIT",
36  "RTEMS_FATAL_SOURCE_BSP",
37  "RTEMS_FATAL_SOURCE_ASSERT",
38  "RTEMS_FATAL_SOURCE_STACK_CHECKER",
39  "RTEMS_FATAL_SOURCE_EXCEPTION",
40  "RTEMS_FATAL_SOURCE_SMP",
41  "RTEMS_FATAL_SOURCE_PANIC",
42  "RTEMS_FATAL_SOURCE_INVALID_HEAP_FREE"
43};
44
45const char *rtems_fatal_source_text( rtems_fatal_source source )
46{
47  size_t i = source;
48  const char *text = "?";
49
50  if ( i < RTEMS_ARRAY_SIZE( fatal_source_text ) ) {
51    text = fatal_source_text[ i ];
52  }
53
54  return text;
55}
Note: See TracBrowser for help on using the repository browser.