purge linux/slab.h usage

Replace the kernel memory alloc funcs with the standard C library ones.

BUG=chromium:878440
TEST=build works

Change-Id: I1214b6ba6b5fe0013d789e9d12bc5b9ca80cc5b5
Reviewed-on: https://chromium-review.googlesource.com/1194721
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
diff --git a/dm-bht.c b/dm-bht.c
index 7471d89..975df68 100644
--- a/dm-bht.c
+++ b/dm-bht.c
@@ -19,7 +19,6 @@
 #include <linux/gfp.h>
 #include <linux/kernel.h>
 #include <linux/scatterlist.h>
-#include <linux/slab.h>  /* k*alloc */
 
 #include "verity/dm-bht.h"
 
@@ -227,8 +226,7 @@
 	 * nodes on the subsequent level or of a specific block on disk.
 	 */
 	bht->levels = (struct dm_bht_level *)
-			kcalloc(bht->depth,
-				sizeof(struct dm_bht_level), GFP_KERNEL);
+			calloc(bht->depth, sizeof(struct dm_bht_level));
 	if (!bht->levels) {
 		DMERR("failed to allocate tree levels");
 		status = -ENOMEM;
@@ -249,8 +247,8 @@
 
 bad_entries_alloc:
 	while (bht->depth-- > 0)
-		kfree(bht->levels[bht->depth].entries);
-	kfree(bht->levels);
+		free(bht->levels[bht->depth].entries);
+	free(bht->levels);
 bad_node_count:
 bad_level_alloc:
 bad_block_count:
@@ -309,9 +307,7 @@
 		 * (b) which specific nodes have been verified.
 		 */
 		level->entries = (struct dm_bht_entry *)
-				 kcalloc(level->count,
-					 sizeof(struct dm_bht_entry),
-					 GFP_KERNEL);
+				 calloc(level->count, sizeof(struct dm_bht_entry));
 		if (!level->entries) {
 			DMERR("failed to allocate entries for depth %d",
 			      bht->depth);
@@ -581,10 +577,10 @@
 				break;
 			}
 		}
-		kfree(bht->levels[depth].entries);
+		free(bht->levels[depth].entries);
 		bht->levels[depth].entries = NULL;
 	}
-	kfree(bht->levels);
+	free(bht->levels);
 	for (cpu = 0; cpu < nr_cpu_ids; ++cpu)
 		if (bht->hash_desc[cpu].tfm)
 			crypto_free_hash(bht->hash_desc[cpu].tfm);
diff --git a/include/linux/slab.h b/include/linux/slab.h
deleted file mode 100644
index 1bdec72..0000000
--- a/include/linux/slab.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Copyright (C) 2010 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by the GPL v2 license that can
- * be found in the LICENSE file.
- * 
- * Parts of this file are derived from the Linux kernel from the file with
- * the same name and path under include/.
- */
-#ifndef VERITY_INCLUDE_LINUX_SLAB_H_
-#define VERITY_INCLUDE_LINUX_SLAB_H_
-#include <sys/types.h>
-
-void *kzalloc(size_t sz, int flags);
-void *kcalloc(size_t n, size_t sz, int flags);
-void kfree(void *x);
-
-#endif  /* VERITY_INCLUDE_LINUX_SLAB_H_ */
diff --git a/kernel/slab.c b/kernel/slab.c
deleted file mode 100644
index bafde64..0000000
--- a/kernel/slab.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 2010 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by the GPL v2 license that can
- * be found in the LICENSE file.
- * 
- * These files provide equivalent implementations for kernel calls for
- * compatibility with files under SRC/include.
- */
-
-#include <linux/slab.h>
-#include <stdlib.h>
-
-void *kzalloc(size_t sz, int flags) 
-{
-	return calloc(1, sz);
-}
-
-void *kcalloc(size_t n, size_t sz, int flags) 
-{
-	return calloc(n, sz);
-}
-
-void kfree(void *x) 
-{
-	if (x)
-		free(x);
-}