public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/8] Fix uninitialized var errors
@ 2021-06-22 11:35 Richard Palethorpe
  2021-06-22 11:35 ` [LTP] [PATCH 1/8] ipc: Fix uninitialized var error by removing useless arg Richard Palethorpe
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Richard Palethorpe @ 2021-06-22 11:35 UTC (permalink / raw)
  To: ltp

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(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-06-22 13:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-22 11:35 [LTP] [PATCH 0/8] Fix uninitialized var errors Richard Palethorpe
2021-06-22 11:35 ` [LTP] [PATCH 1/8] ipc: Fix uninitialized var error by removing useless arg Richard Palethorpe
2021-06-22 11:35 ` [LTP] [PATCH 2/8] ftest: Fix uninitialized var error Richard Palethorpe
2021-06-22 11:35 ` [LTP] [PATCH 3/8] hotplug: Fix uninitialized var Richard Palethorpe
2021-06-22 11:35 ` [LTP] [PATCH 4/8] dio: Fix uninitialized var error Richard Palethorpe
2021-06-22 11:35 ` [LTP] [PATCH 5/8] ksmg01: " Richard Palethorpe
2021-06-22 11:35 ` [LTP] [PATCH 6/8] shmat01: " Richard Palethorpe
2021-06-22 11:35 ` [LTP] [PATCH 7/8] crash02: Save actual child PID instead of uninitialized variable Richard Palethorpe
2021-06-22 11:35 ` [LTP] [PATCH 8/8] locktests: Fix uninitialized var error Richard Palethorpe
2021-06-22 13:54 ` [LTP] [PATCH 0/8] Fix uninitialized var errors Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox