From: Florian Bezdeka <florian.bezdeka@siemens.com>
To: jan.kiszka@siemens.com, xenomai@lists.linux.dev
Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>,
Florian Bezdeka <florian.bezdeka@siemens.com>
Subject: [PATCH] lib/psos/task.c: Fix psos tests, incorrect error reporting
Date: Tue, 12 Dec 2023 11:01:05 +0100 [thread overview]
Message-ID: <20231212-flo-fix-testsuite-v1-1-614eb1703e08@siemens.com> (raw)
The following smokey test failure was seen on the current next branch:
[1] at task-4.c:22
0\"011.394| BUG in __traceobj_assert_failed(): [TASK] trace assertion failed:
task-4.c:36 => \"ret == 0 && regval == 0xdeadbeef\"
test psostests_task4 failed: 256
The problem was introduced in
8dceca122dbb ("lib/psos/task.c: fix build with gcc >= 12 and -Ofast"),
the second parameter of get_psos_task() was unconditionally initialized
with ERR_OBJDEL. Even if no error occurred later on, an error was
reported.
All users of get_psos_task() and get_psos_task_or_self() have to
initialize the second parameter when the care about the returned error
code afterwards. The value of the parameter will only be overwritten in
case of an error.
Fixes: 8dceca122dbb ("lib/psos/task.c: fix build with gcc >= 12 and -Ofast")
CC: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
lib/psos/task.c | 9 ++++-----
lib/psos/tm.c | 2 +-
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/lib/psos/task.c b/lib/psos/task.c
index 5341289df..70b5c6596 100644
--- a/lib/psos/task.c
+++ b/lib/psos/task.c
@@ -96,7 +96,6 @@ static struct psos_task *find_psos_task_or_self(u_long tid, int *err_r)
struct psos_task *get_psos_task(u_long tid, int *err_r)
{
- *err_r = ERR_OBJDEL;
struct psos_task *task = find_psos_task(tid, err_r);
/*
@@ -360,7 +359,7 @@ u_long t_start(u_long tid,
{
struct psos_task *task;
struct service svc;
- int ret;
+ int ret = SUCCESS;
CANCEL_DEFER(svc);
@@ -401,7 +400,7 @@ u_long t_suspend(u_long tid)
{
struct psos_task *task;
struct service svc;
- int ret;
+ int ret = SUCCESS;
CANCEL_DEFER(svc);
@@ -424,7 +423,7 @@ u_long t_resume(u_long tid)
{
struct psos_task *task;
struct service svc;
- int ret;
+ int ret = SUCCESS;
CANCEL_DEFER(svc);
@@ -491,7 +490,7 @@ u_long t_delete(u_long tid)
{
struct psos_task *task;
struct service svc;
- int ret;
+ int ret = SUCCESS;
CANCEL_DEFER(svc);
diff --git a/lib/psos/tm.c b/lib/psos/tm.c
index 09cb47f6e..7b4c755a7 100644
--- a/lib/psos/tm.c
+++ b/lib/psos/tm.c
@@ -105,7 +105,7 @@ static u_long start_evtimer(u_long events,
void (*handler)(struct timerobj *tmobj);
struct psos_task *current;
struct psos_tm *tm;
- int ret;
+ int ret = SUCCESS;
tm = pvmalloc(sizeof(*tm));
if (tm == NULL)
---
base-commit: cae69c97940d60956667e4c9e86d7869ae0aa2da
change-id: 20231212-flo-fix-testsuite-36fcc1693ea3
Best regards,
--
Florian Bezdeka <florian.bezdeka@siemens.com>
next reply other threads:[~2023-12-12 10:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-12 10:01 Florian Bezdeka [this message]
2023-12-12 10:47 ` [PATCH] lib/psos/task.c: Fix psos tests, incorrect error reporting Jan Kiszka
2023-12-12 12:13 ` Florian Bezdeka
2023-12-12 13:15 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231212-flo-fix-testsuite-v1-1-614eb1703e08@siemens.com \
--to=florian.bezdeka@siemens.com \
--cc=fontaine.fabrice@gmail.com \
--cc=jan.kiszka@siemens.com \
--cc=xenomai@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).