socsvn commit: r288521 - soc2013/def/crashdump-head/sbin/cryptcore

def at FreeBSD.org def at FreeBSD.org
Sat Jul 18 12:54:38 UTC 2015


Author: def
Date: Sat Jul 18 12:54:36 2015
New Revision: 288521
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=288521

Log:
  Don't cast pointers returned by calloc and realloc.

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	Sat Jul 18 12:49:56 2015	(r288520)
+++ soc2013/def/crashdump-head/sbin/cryptcore/cryptcore.c	Sat Jul 18 12:54:36 2015	(r288521)
@@ -51,7 +51,7 @@
 		pjdlog_exitx(1, "Unable to read data from %s.", pubkeyfile);
 
 	pubkeysize = RSA_size(pubkey);
-	encryptedkey = (uint8_t *)calloc(1, pubkeysize);
+	encryptedkey = calloc(1, pubkeysize);
 	if (encryptedkey == NULL)
 		pjdlog_exitx(1, "Unable to allocate encrypted key");
 
@@ -113,7 +113,7 @@
 		pjdlog_exitx(1, "Unable to allocate an RSA structure.");
 	EVP_CIPHER_CTX_init(&ctx);
 
-	kdk = (struct kerneldumpkey *)calloc(1, sizeof(struct kerneldumpkey));
+	kdk = calloc(1, sizeof(struct kerneldumpkey));
 	if (kdk == NULL)
 		pjdlog_exit(1, "Unable to allocate kernel dump key");
 
@@ -122,7 +122,7 @@
 		pjdlog_exit(1, "Unable to open %s", keyfile);
 	size = (int)read(fd, kdk, sizeof(struct kerneldumpkey));
 	if (size == sizeof(struct kerneldumpkey)) {
-		kdk = (struct kerneldumpkey *)realloc(kdk, kdk->kdk_size);
+		kdk = realloc(kdk, kdk->kdk_size);
 		size += read(fd, &kdk->kdk_encryptedkey,
 		    kdk->kdk_size - sizeof(struct kerneldumpkey));
 	}


More information about the svn-soc-all mailing list