All of lore.kernel.org
 help / color / mirror / Atom feed
From: Constantine Shulyupin <const@MakeLinux.com>
To: "Theodore Ts'o" <tytso@mit.edu>, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org (open list)
Cc: Constantine Shulyupin <const@MakeLinux.com>
Subject: [PATCH] drivers/char/random.c: fix uninitialized value warning
Date: Wed, 18 Jul 2018 10:11:52 +0300	[thread overview]
Message-ID: <20180718071152.13265-1-const@MakeLinux.com> (raw)

Local variable t should be initialized by arch_get_random_int.
Actually on failure of arch_get_random_int, value is not used.
So, just keep the build clean with less warnings.

warning:
drivers/char/random.c: In function ‘write_pool.constprop’:
drivers/char/random.c:1912:11: warning: ‘t’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Constantine Shulyupin <const@MakeLinux.com>
---
 drivers/char/random.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 283fe390e878..8e51846d0673 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1896,7 +1896,7 @@ static int
 write_pool(struct entropy_store *r, const char __user *buffer, size_t count)
 {
 	size_t bytes;
-	__u32 t, buf[16];
+	__u32 t = 0, buf[16];
 	const char __user *p = buffer;
 
 	while (count > 0) {
-- 
2.17.1


             reply	other threads:[~2018-07-18  7:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-18  7:11 Constantine Shulyupin [this message]
2018-07-18 15:24 ` [PATCH] drivers/char/random.c: fix uninitialized value warning Theodore Y. Ts'o
2018-07-18 15:38 ` Arnd Bergmann

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=20180718071152.13265-1-const@MakeLinux.com \
    --to=const@makelinux.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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.