All of lore.kernel.org
 help / color / mirror / Atom feed
From: william.c.roberts@intel.com
To: selinux@tycho.nsa.gov, sds@tycho.nsa.gov, brindle@quarksecurity.com
Subject: [PATCH 3/3] libsepol: fix unitialized variable 'nread' on mac build
Date: Fri, 23 Sep 2016 13:55:52 -0700	[thread overview]
Message-ID: <1474664152-18727-4-git-send-email-william.c.roberts@intel.com> (raw)
In-Reply-To: <1474664152-18727-1-git-send-email-william.c.roberts@intel.com>

From: William Roberts <william.c.roberts@intel.com>

Fix this:
genusers.c:63:14: warning: variable 'nread' is uninitialized when used here [-Wuninitialized]
                if (buffer[nread - 1] == '\n')
                           ^~~~~
genusers.c:40:15: note: initialize the variable 'nread' to silence this warning
        ssize_t nread;
                     ^
                      = 0

Signed-off-by: William Roberts <william.c.roberts@intel.com>
---
 libsepol/src/genusers.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libsepol/src/genusers.c b/libsepol/src/genusers.c
index 57a9a2e..5568210 100644
--- a/libsepol/src/genusers.c
+++ b/libsepol/src/genusers.c
@@ -53,6 +53,7 @@ static int load_users(struct policydb *policydb, const char *path)
 	}
 
 	while(fgets(buffer, 255, fp) != NULL) {
+		nread = strlen(buffer);
 #else
 	size_t len = 0;
 	__fsetlocking(fp, FSETLOCKING_BYCALLER);
-- 
1.9.1

  parent reply	other threads:[~2016-09-23 20:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23 20:55 Libsepol Mac Build Errors william.c.roberts
2016-09-23 20:55 ` [PATCH 1/3] libsepol: fix unused variable 'size' on mac build william.c.roberts
2016-09-23 20:55 ` [PATCH 2/3] libsepol: fix unused variable 'len' " william.c.roberts
2016-09-23 20:55 ` william.c.roberts [this message]
2016-09-26 14:37   ` [PATCH 3/3] libsepol: fix unitialized variable 'nread' " Stephen Smalley
2016-09-24  1:10 ` Libsepol Mac Build Errors Joshua Brindle
2016-09-24  1:39   ` William Roberts
2016-09-24  1:42     ` Joshua Brindle
2016-09-24  1:51       ` William Roberts

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=1474664152-18727-4-git-send-email-william.c.roberts@intel.com \
    --to=william.c.roberts@intel.com \
    --cc=brindle@quarksecurity.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.