[PATCH 3/4] cifs.upcall: swap c99 initializers for memset calls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



gcc says:

cifs.upcall.c: In function ‘cifs_krb5_get_req’:
cifs.upcall.c:261:2: warning: missing initializer
cifs.upcall.c:261:2: warning: (near initialization for ‘in_creds.client’)
cifs.upcall.c: In function ‘main’:
cifs.upcall.c:622:9: warning: missing initializer
cifs.upcall.c:622:9: warning: (near initialization for ‘arg.ver’)

...this is probably just gcc being balky, but we can silence the
warning. It may also be a micro optimization in an error condition
if we delay zeroing out the struct until it's needed.

Signed-off-by: Jeff Layton <jlayton@xxxxxxxxx>
---
 cifs.upcall.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/cifs.upcall.c b/cifs.upcall.c
index 8f7850a..9b1436e 100644
--- a/cifs.upcall.c
+++ b/cifs.upcall.c
@@ -258,7 +258,7 @@ cifs_krb5_get_req(const char *principal, const char *ccname,
 	krb5_keyblock *tokb;
 	krb5_context context;
 	krb5_ccache ccache;
-	krb5_creds in_creds = { }, *out_creds;
+	krb5_creds in_creds, *out_creds;
 	krb5_data apreq_pkt, in_data;
 	krb5_auth_context auth_context = NULL;
 
@@ -275,6 +275,8 @@ cifs_krb5_get_req(const char *principal, const char *ccname,
 		goto out_free_context;
 	}
 
+	memset(&in_creds, 0, sizeof(in_creds));
+
 	ret = krb5_cc_get_principal(context, ccache, &in_creds.client);
 	if (ret) {
 		syslog(LOG_DEBUG, "%s: unable to get client principal name",
@@ -619,7 +621,7 @@ int main(const int argc, char *const argv[])
 	int c, try_dns = 0, legacy_uid = 0;
 	char *buf, *princ = NULL, *ccname = NULL;
 	char hostbuf[NI_MAXHOST], *host;
-	struct decoded_args arg = { };
+	struct decoded_args arg;
 	const char *oid;
 
 	hostbuf[0] = '\0';
@@ -677,6 +679,8 @@ int main(const int argc, char *const argv[])
 		goto out;
 	}
 
+	memset(&arg, 0, sizeof(arg));
+
 	have = decode_key_description(buf, &arg);
 	SAFE_FREE(buf);
 	if ((have & DKD_MUSTHAVE_SET) != DKD_MUSTHAVE_SET) {
-- 
1.7.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux