All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sun Ke <sunke32@huawei.com>
To: <fstests@vger.kernel.org>, <sunke32@huawei.com>
Subject: [PATCH] src/swapon.c: initiate p to NULL
Date: Thu, 28 Jan 2021 14:50:10 +0800	[thread overview]
Message-ID: <20210128065010.218830-1-sunke32@huawei.com> (raw)

when run make, show:
swapon.c:135:3: warning: 'p' may be used uninitialized in this function
[-Wmaybe-uninitialized]
   memcpy(p, buf, BUF_SIZE);
      ^~~~~~~~~~~~~~~~~~~~~~~~
fix it.

Signed-off-by: Sun Ke <sunke32@huawei.com>
---
 src/swapon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/swapon.c b/src/swapon.c
index afaed405..fe8949a3 100644
--- a/src/swapon.c
+++ b/src/swapon.c
@@ -41,7 +41,7 @@ int main(int argc, char **argv)
 		.sa_handler	= handle_signal,
 	};
 	enum verbs verb = TEST_SWAPON;
-	void *p;
+	void *p = NULL;
 	ssize_t sz;
 	int fd = -1;
 	int ret, c;
-- 
2.13.6


             reply	other threads:[~2021-01-28  6:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28  6:50 Sun Ke [this message]
2021-01-30  4:58 ` [PATCH] src/swapon.c: initiate p to NULL Zorro Lang
2021-02-01  3:18   ` sunke (E)

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=20210128065010.218830-1-sunke32@huawei.com \
    --to=sunke32@huawei.com \
    --cc=fstests@vger.kernel.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 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.