public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] rt: Initialize mq_send input on tst-mqueue{5,6}
Date: Wed,  5 Oct 2022 21:43:44 +0000 (GMT)	[thread overview]
Message-ID: <20221005214344.D9FDF3857416@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cbf24edbb3123e3154ad2366912e0c1270ad3546

commit cbf24edbb3123e3154ad2366912e0c1270ad3546
Author: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Date:   Wed Sep 21 10:51:06 2022 -0300

    rt: Initialize mq_send input on tst-mqueue{5,6}
    
    GCC with -Os warns that the mq_send input may be used uninitialized.
    Although for the tests the data content sent is not important, since
    both tests checks only if mq_notify was properly set, the warning is
    correct and data is indeed uninitialized.
    
    Checked on x86_64-linux-gnu and i686-linux-gnu.
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    Tested-by: Carlos O'Donell <carlos@redhat.com>

Diff:
---
 rt/tst-mqueue5.c | 2 +-
 rt/tst-mqueue6.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/rt/tst-mqueue5.c b/rt/tst-mqueue5.c
index 70d97a36c2..2b19b6a031 100644
--- a/rt/tst-mqueue5.c
+++ b/rt/tst-mqueue5.c
@@ -58,7 +58,7 @@ rtmin_handler (int sig, siginfo_t *info, void *ctx)
 static int
 (mqsend) (mqd_t q, int line)
 {
-  char c;
+  char c = 0;
   if (mq_send (q, &c, 1, 1) != 0)
     {
       printf ("mq_send on line %d failed with: %m\n", line);
diff --git a/rt/tst-mqueue6.c b/rt/tst-mqueue6.c
index bc875f101e..a22ac05aca 100644
--- a/rt/tst-mqueue6.c
+++ b/rt/tst-mqueue6.c
@@ -40,7 +40,7 @@
 static int
 (mqsend) (mqd_t q, int line)
 {
-  char c;
+  char c = 0;
   if (mq_send (q, &c, 1, 1) != 0)
     {
       printf ("mq_send on line %d failed with: %m\n", line);

                 reply	other threads:[~2022-10-05 21:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221005214344.D9FDF3857416@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /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).