xenomai.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Florian Bezdeka <florian.bezdeka@siemens.com>
To: Jan Kiszka <jan.kiszka@siemens.com>,
	Fabrice Fontaine <fontaine.fabrice@gmail.com>,
	xenomai@lists.linux.dev
Subject: Re: [PATCH v3] lib/psos/task.c: fix build with gcc >= 12 and -Ofast
Date: Tue, 12 Dec 2023 10:08:26 +0100	[thread overview]
Message-ID: <7eb3eb155e8bfd12a6d60fb556055f481ea4d354.camel@siemens.com> (raw)
In-Reply-To: <5897736d591a75e317a0c60b2f3fb102043d94d2.camel@siemens.com>

On Tue, 2023-12-12 at 09:59 +0100, Florian Bezdeka wrote:
> On Tue, 2023-12-05 at 07:14 +0900, Jan Kiszka wrote:
> > On 04.12.23 21:36, Florian Bezdeka wrote:
> > > On Mon, 2023-12-04 at 21:52 +0900, Jan Kiszka wrote:
> > > > On 04.12.23 16:39, Fabrice Fontaine wrote:
> > > > > Fix the following build failure with gcc >= 12 and -Ofast (found by
> > > > > buildroot autobuilders on xenomai 3.0.10 [1]):
> > > > > 
> > > > > task.c: In function 't_start':
> > > > > task.c:398:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
> > > > >   398 |         return ret;
> > > > >       |                ^~~
> > > > > task.c:364:13: note: 'ret' was declared here
> > > > >   364 |         int ret;
> > > > >       |             ^~~
> > > > > task.c: In function 't_resume':
> > > > > task.c:444:16: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
> > > > >   444 |         return ret;
> > > > >       |                ^~~
> > > > > task.c:428:13: note: 'ret' was declared here
> > > > >   428 |         int ret;
> > > > >       |             ^~~
> > > > > 
> > > > > [1] http://autobuild.buildroot.org/results/bc1b40de22e563b704ad7f20b6bf4d1f73a6ed8a
> > > > > 
> > > > > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > > > > ---
> > > > > Changes v2 -> v3 (after review of Jan Kiszka and Florian Bezdeka):
> > > > >  - Move ERR_OBJDEL to get_psos_task
> > > > >  - Update commit message to mention -Ofast and xenomai 3.0.10
> > > > > 
> > > > > Changes v1 -> v2 (after review of Jan Kiszka):
> > > > >  - Replace SUCCESS by ERR_OBJDEL
> > > > > 
> > > > >  lib/psos/task.c | 1 +
> > > > >  1 file changed, 1 insertion(+)
> > > > > 
> > > > > diff --git a/lib/psos/task.c b/lib/psos/task.c
> > > > > index f678be61d..b5cd087e4 100644
> > > > > --- a/lib/psos/task.c
> > > > > +++ b/lib/psos/task.c
> > > > > @@ -99,6 +99,7 @@ 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);
> > > > >  
> > > > >  	/*
> > > > 
> > > > Thanks, applied.
> > > 
> > > Hm... err_r can never be NULL?
> > > 
> > 
> > This function already assumed that err_r is always non-NULL before this
> > change.
> 
> This patch makes the smokey testsuite fail, psostests reports:
> 
> 2023-12-07T10:59:27 [1] at task-4.c:22
> 2023-12-07T10:59:27    0\"011.394| BUG in __traceobj_assert_failed(): [TASK] trace assertion failed:
> 2023-12-07T10:59:27               task-4.c:36 => \"ret == 0 && regval == 0xdeadbeef\"
> 2023-12-07T10:59:27 test psostests_task4 failed: 256
> 
> ret is now 5 (ERR_OBJDEL) instead of the expected 0 (SUCCESS).
> 

Had a closer look again. All users of get_psos_task_or_self() should
initialize the second parameter. Most of them do, but not all.

I can take this one...

> > 
> > Jan
> > 
> > -- 
> > Siemens AG, Technology
> > Linux Expert Center


      reply	other threads:[~2023-12-12  9:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04  8:39 [PATCH v3] lib/psos/task.c: fix build with gcc >= 12 and -Ofast Fabrice Fontaine
2023-12-04 12:52 ` Jan Kiszka
2023-12-04 13:36   ` Florian Bezdeka
2023-12-04 22:14     ` Jan Kiszka
2023-12-12  8:59       ` Florian Bezdeka
2023-12-12  9:08         ` Florian Bezdeka [this message]

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=7eb3eb155e8bfd12a6d60fb556055f481ea4d354.camel@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).