From: Abhijit Pawar <abhi.c.pawar@gmail.com>
To: Tyler Hicks <tyhicks@canonical.com>,
Dustin Kirkland <dustin.kirkland@gazzang.com>
Cc: ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Abhijit Pawar <abhi.c.pawar@gmail.com>
Subject: [PATCH 1/2] fs:ecryptfs basic code optimization
Date: Mon, 12 Nov 2012 14:17:27 +0530 [thread overview]
Message-ID: <1352710047-3663-1-git-send-email-abhi.c.pawar@gmail.com> (raw)
debug.c: ecryptfs_dump_auth_tok () : salt and sig arrays initialized so as to avoid adding null terminator explicitly.
Signed-off-by: Abhijit Pawar <abhi.c.pawar@gmail.com>
---
fs/ecryptfs/debug.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/ecryptfs/debug.c b/fs/ecryptfs/debug.c
index 3d2bdf5..480e3b5 100644
--- a/fs/ecryptfs/debug.c
+++ b/fs/ecryptfs/debug.c
@@ -31,8 +31,8 @@
*/
void ecryptfs_dump_auth_tok(struct ecryptfs_auth_tok *auth_tok)
{
- char salt[ECRYPTFS_SALT_SIZE * 2 + 1];
- char sig[ECRYPTFS_SIG_SIZE_HEX + 1];
+ char salt[ECRYPTFS_SALT_SIZE * 2 + 1] = {'\0'};
+ char sig[ECRYPTFS_SIG_SIZE_HEX + 1] = {'\0'};
ecryptfs_printk(KERN_DEBUG, "Auth tok at mem loc [%p]:\n",
auth_tok);
@@ -42,7 +42,6 @@ void ecryptfs_dump_auth_tok(struct ecryptfs_auth_tok *auth_tok)
ecryptfs_printk(KERN_DEBUG, " * passphrase type\n");
ecryptfs_to_hex(salt, auth_tok->token.password.salt,
ECRYPTFS_SALT_SIZE);
- salt[ECRYPTFS_SALT_SIZE * 2] = '\0';
ecryptfs_printk(KERN_DEBUG, " * salt = [%s]\n", salt);
if (auth_tok->token.password.flags &
ECRYPTFS_PERSISTENT_PASSWORD) {
@@ -50,7 +49,6 @@ void ecryptfs_dump_auth_tok(struct ecryptfs_auth_tok *auth_tok)
}
memcpy(sig, auth_tok->token.password.signature,
ECRYPTFS_SIG_SIZE_HEX);
- sig[ECRYPTFS_SIG_SIZE_HEX] = '\0';
ecryptfs_printk(KERN_DEBUG, " * signature = [%s]\n", sig);
}
ecryptfs_printk(KERN_DEBUG, " * session_key.flags = [0x%x]\n",
--
1.7.7.6
reply other threads:[~2012-11-12 8:48 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=1352710047-3663-1-git-send-email-abhi.c.pawar@gmail.com \
--to=abhi.c.pawar@gmail.com \
--cc=dustin.kirkland@gazzang.com \
--cc=ecryptfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tyhicks@canonical.com \
/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
all inboxes | Powered by JetHome®