drivers/net/ftmac100.c, libs/libc/stdlib/lib_aligned_alloc.c
A continuation of PRs #1507, #1510, and #1512. See Issue #1481 for additional information.
malloc() and free() should never be used within the OS. This will work in the FLAT build because there is only a single heap, but will cause problems in PROTECTED and KERNEL build modes where there are separate heaps for user and kernel memory.
Typically kmm_malloc(), kmm_zalloc(), and kmm_free() should be called within the kernel in those build modes to use the kernel heap.
Memory is never free. Possible memory leak:
./boards/arm/cxd56xx/common/src/cxd56_crashdump.c: pdump = malloc(sizeof(fullcontext_t));
Memory allocated with malloc(), but freed with kmm_free():
./drivers/usbhost/usbhost_composite.c: cfgbuffer = (FAR uint8_t *)malloc(CUSTOM_CONFIG_BUFSIZE);
Memory is never freed in these cases. It is allocated in the driver initialization logic, but there is no corresponding uninitialization logic; memory is not freed on error conditions:
./arch/arm/src/lc823450/lc823450_i2s.c: priv = (struct lc823450_i2s_s *)zalloc(sizeof(struct lc823450_i2s_s));
./arch/arm/src/sam34/sam_spi.c: spics = (struct sam_spics_s *)zalloc(sizeof(struct sam_spics_s));
./arch/arm/src/sama5/sam_spi.c: spics = (struct sam_spics_s *)zalloc(sizeof(struct sam_spics_s));
./arch/arm/src/samv7/sam_spi.c: spics = (struct sam_spics_s *)zalloc(sizeof(struct sam_spics_s));
Memory is allocated with zalloc() but freed on error conditions with kmm_free():
./arch/arm/src/sama5/sam_ssc.c: priv = (struct sam_ssc_s *)zalloc(sizeof(struct sam_ssc_s));
./arch/arm/src/samv7/sam_ssc.c: priv = (struct sam_ssc_s *)zalloc(sizeof(struct sam_ssc_s));
./arch/arm/src/stm32/stm32_i2s.c: priv = (struct stm32_i2s_s *)zalloc(sizeof(struct stm32_i2s_s));
Memory is never freed:
./drivers/spi/spi_bitbang.c: priv = (FAR struct spi_bitbang_s *)zalloc(sizeof(struct spi_bitbang_s));
arch/arm/src/cxd56xx/cxd56_gnss.c, arch/arm/src/xmc4/xmc4_spi.c,
crypto/blake2s.c, drivers/lcd/pcf8574_lcd_backpack.c, drivers/lcd/st7032.c
User space memory should not be used within the OS and, when it is absolutely necessary to use user-space memory, it should be allocated using kumm_malloc().
drivers/net/telnet.c
drivers/wireless/bluetooth/bt_uart_bcm4343x.c
drivers/wireless/ieee802154/mrf24j40/mrf24j40.c
Kernel memory was allocated using kmm_malloc() or kmm_zalloc() but freed with with the user-space allocator free(). In the FLAT build, this is bad style, but not harmful because there is only a single, heap and malloc() and kmm_malloc() map to the same function.
But that is not true in the case of the PROTECTED or KERNEL builds. In those cases, there are separate heaps. kmm_malloc() will allocate from the kernel heap. free() will attempt to free the kernel memory from the user heap and will cause an assertion (or other obscure failure if assertions are disabled).
clang-check complained like the following.
While this is not a real bug, it's easy to appease.
sim/up_exit.c:68:21: warning: Value stored to 'tcb' during its initialization is never read
FAR struct tcb_s *tcb = this_task();
^~~ ~~~~~~~~~~~
1 warning generated.
Found by clang-check:
usbhost/hid_parser.c:278:26: warning: Assigned value is garbage or undefined
usage[i] = usage[i + 1];
^ ~~~~~~~~~~~~
usbhost/hid_parser.c:321:34: warning: Assigned value is garbage or undefined
usage[i] = usage[i + 1];
^ ~~~~~~~~~~~~
2 warnings generated.
Found by clang-check:
tcp/tcp_timer.c:185:15: warning: Value stored to 'result' is never read
result = tcp_callback(dev, conn, TCP_TIMEDOUT);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tcp/tcp_timer.c:264:23: warning: Value stored to 'result' is never read
result = tcp_callback(dev, listener, TCP_TIMEDOUT);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tcp/tcp_timer.c:300:19: warning: Value stored to 'result' is never read
result = tcp_callback(dev, conn, TCP_TIMEDOUT);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
ESP32 runs code in a SPI Flash, so users can also use it to store
data directly or mount some parts into a filesystem.
The SPI Flash usually use SPI0.
This driver was implemented by Dong Heng dongheng@espressif.com
and modified to fix coding style by Alan Carvalho de Assis.
New CONFIG_FAT_LFN_UTF8: UTF8 strings are converted to UCS2-LFN
Bugfix in fat_createalias: space is now also converted to underbar.
Change (bugfix) in fat_getlfname: init characters (0xff) and '\0' are rewound as well.
Provide functions which get and set the 3A (Auto white balance/Auto
exposure/Auto
focus) parameters.
These are achieved by the ioctl request codes VIDIOC_G_EXT_CTRLS and
VIDIOC_S_EXT_CTRLS which have the following settings:
1. ctrl_class = V4L2_CTRL_CLASS_CAMERA
2. id = V4L2_CID_3A_PARAMETER
Also, provide function which get the 3A adjustment status.
This is achieved by the ioctl request codes VIDIOC_G_EXT_CTRLS which has the
following settings:
1. ctrl_class = V4L2_CTRL_CLASS_CAMERA
2. id = V4L2_CID_3A_STATUS
Fix the following three bugs about ON/OFF control of auto white balance and auto
exposure:
- The returned value of VIDIOC_G_CTRL with id = V4L2_CID_AUTO_WHITE_BALANCE is
different from V4L2 specification.
- Auto exposure is locked if auto white balance lock is requested.
- Auto exposure and auto white balance are locked if auto exposure lock is
requested.
Add imageproc_alpha_blend() to blend two images in a specified ratio.
The blended source image is selectable from the following two types:
- Single color image
- YUV422 image
The blend ratio is selectable from the following three types:
- Blend ratio with single value
- Blend ratio with 1bpp
- Blend ratio with 8bpp
Summary:
- Fix style violations under lc823450
Impact:
- Some APIs were changed but all files are included
Testing:
- Build check only
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Found by clang-check:
modlib/modlib_sections.c:93:3: warning: Value stored to 'buffer' is never read
buffer = loadinfo->iobuffer;
^ ~~~~~~~~~~~~~~~~~~
1 warning generated.
Found by clang-check:
mqueue/mq_close.c:127:21: warning: Value stored to 'rtcb' during its initialization is never read
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)nxsched_self();
^~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
Found by clang-check:
sched/sched_waitpid.c:380:33: warning: Although the value stored to 'ret' is used in the enclosing expression, the value is never actually read from 'ret'
(pid != (pid_t)-1 && (ret = nxsig_kill(pid, 0)) < 0))
^ ~~~~~~~~~~~~~~~~~~
1 warning generated.
Found by clang-check:
mount/fs_mount.c:287:8: warning: Although the value stored to 'ret' is used in
the enclosing expression, the value is never actually read from 'ret'
(ret = find_blockdriver(source, mountflags, &drvr_inode)) >= 0)
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
Found by clang-check:
romfs/fs_romfs.c:431:7: warning: Value stored to 'bytesread' is never read
bytesread = 0;
^ ~
romfs/fs_romfs.c:455:11: warning: Value stored to 'sector' is never read
sector += nsectors;
^ ~~~~~~~~
2 warnings generated.
custom board.
Custom boards don't set CONFIG_ARCH_BOARD since the full path is given
during configuration.
Furthermore this creates problems when when referencing other
folders using BOARD_DIR because a trailing DELIM will be present.
Summary:
- Fix style violations under lc823450
- NOTE: still some files need to be fixed
Impact:
- Some register naming were changed but all files are included
Testing:
- Build check only
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Summary:
- Fix style violations in lc823450_syscontrol.h
Impact:
- This commit affects register naming in syscontrol.
- So some files such as lc823450_start.c lc823450_mux.c were also changed.
Testing:
- Build check only
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Found by clang-check:
syslog/syslog_write.c:96:7: warning: Value stored to 'nwritten' is never read
nwritten = g_syslog_channel->sc_write(buffer, buflen);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.