Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Aug 2015 17:44:07 GMT
From:      def@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r289830 - soc2013/def/crashdump-head/sbin/cryptcore
Message-ID:  <201508171744.t7HHi7mh096484@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: def
Date: Mon Aug 17 17:44:06 2015
New Revision: 289830
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289830

Log:
  Use a variable instead of a structure name to calculate size.

Modified:
  soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c

Modified: soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c
==============================================================================
--- soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c	Mon Aug 17 16:51:37 2015	(r289829)
+++ soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c	Mon Aug 17 17:44:06 2015	(r289830)
@@ -111,20 +111,20 @@
 		pjdlog_exitx(1, "Unable to allocate an RSA structure.");
 	EVP_CIPHER_CTX_init(&ctx);
 
-	kdk = calloc(1, sizeof(struct kerneldumpkey));
+	kdk = calloc(1, sizeof(*kdk));
 	if (kdk == NULL)
 		pjdlog_exit(1, "Unable to allocate kernel dump key");
 
 	fd = open(keyfile, O_RDONLY);
 	if (fd == -1)
 		pjdlog_exit(1, "Unable to open %s", keyfile);
-	size = read(fd, kdk, sizeof(struct kerneldumpkey));
-	if (size == (ssize_t)sizeof(struct kerneldumpkey)) {
+	size = read(fd, kdk, sizeof(*kdk));
+	if (size == (ssize_t)sizeof(*kdk)) {
 		kdk = realloc(kdk, kdk->kdk_size);
 		if (kdk == NULL)
 			pjdlog_exit(1, "Unable to reallocate kernel dump key");
 		size += read(fd, &kdk->kdk_encryptedkey,
-		    kdk->kdk_size - sizeof(struct kerneldumpkey));
+		    kdk->kdk_size - sizeof(*kdk));
 	}
 	err = errno;
 	close(fd);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508171744.t7HHi7mh096484>