Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Jul 2015 12:54:37 GMT
From:      def@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r288521 - soc2013/def/crashdump-head/sbin/cryptcore
Message-ID:  <201507181254.t6ICsb5m084507@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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));
 	}



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