Skip to content

Fix uninitialized var errors

Richard Palethorpe ltp 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8ipc: Fix uninitialized var error by removing useless arglibs/libltpipc/libipc.c testcases/kernel/syscalls/ipc/semctl/semctl01.c+2 -60 replies
2/8ftest: Fix uninitialized var errortestcases/kernel/fs/ftest/ftest01.c testcases/kernel/fs/ftest/ftest05.c+2 -40 replies
3/8hotplug: Fix uninitialized vartestcases/kernel/hotplug/memory_hotplug/commands.c+1 -60 replies
4/8dio: Fix uninitialized var errortestcases/kernel/io/ltp-aiodio/dio_append.c testcases/kernel/io/ltp-aiodio/dio_sparse.c testcases/kernel/io/ltp-aiodio/dio_truncate.c+4 -40 replies
5/8ksmg01: Fix uninitialized var errortestcases/kernel/logging/kmsg/kmsg01.c+1 -10 replies
6/8shmat01: Fix uninitialized var errortestcases/kernel/syscalls/ipc/shmat/shmat01.c+1 -10 replies
7/8crash02: Save actual child PID instead of uninitialized variabletestcases/misc/crash/crash02.c+3 -30 replies
8/8locktests: Fix uninitialized var errortestcases/network/nfsv4/locks/locktests.c+1 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [LTP] [PATCH 0/8] Fix uninitialized var errors

Hello,

It would be nice if we could set --Werror=uninitialized by default. Uninitialized variables can result in nasty compiler behaviour. You may expect it just to result in garbage data being used. The result being a crash. However as we compile with -O2 this is not the case. Often the compiler chooses values for the variable which will eliminate code. This often means the values are valid. The result being a program which appears to execute correctly on the surface. Meanwhile underneath it is doing very little.

In a lot of cases the compiler is simply confused and gives an error, but there is no undefined behaviour. This is often caused by tst_brk which is the source of much confusion. Most likely there should be two versions of tst_brk. One which never returns and is used by test authors and one which can return, but is usually only used in library functions which may be called from cleanup.

Richard Palethorpe (8):
ipc: Fix uninitialized var error by removing useless arg
ftest: Fix uninitialized var error
hotplug: Fix uninitialized var
dio: Fix uninitialized var error
ksmg01: Fix uninitialized var error
shmat01: Fix uninitialized var error
crash02: Save actual child PID instead of uninitialized variable
locktests: Fix uninitialized var error

 libs/libltpipc/libipc.c                            | 4 +---
 testcases/kernel/fs/ftest/ftest01.c                | 3 +--
 testcases/kernel/fs/ftest/ftest05.c                | 3 +--
 testcases/kernel/hotplug/memory_hotplug/commands.c | 7 +------
 testcases/kernel/io/ltp-aiodio/dio_append.c        | 2 +-
 testcases/kernel/io/ltp-aiodio/dio_sparse.c        | 2 +-
 testcases/kernel/io/ltp-aiodio/dio_truncate.c      | 4 ++--
 testcases/kernel/logging/kmsg/kmsg01.c             | 2 +-
 testcases/kernel/syscalls/ipc/semctl/semctl01.c    | 4 +---
 testcases/kernel/syscalls/ipc/shmat/shmat01.c      | 2 +-
 testcases/misc/crash/crash02.c                     | 6 +++---
 testcases/network/nfsv4/locks/locktests.c          | 2 +-
 12 files changed, 15 insertions(+), 26 deletions(-)
Signature · 1 line
2.31.1