Combine CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES and the zero_memory
modparam into a single option by forcing zero_memory=1 when
CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES is set, and always using
zero_memory to decided whether to zero or not.
Change-Id: I9ce0106cfaea950bd9494b697916fbc2a03329ea
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/664672
GVS: Gerrit_Virtual_Submit
Reviewed-on: http://git-master/r/736426
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Tested-by: Alex Waterman <alexw@nvidia.com>
#include "nvmap_priv.h"
#include "nvmap_ioctl.h"
+#ifdef CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES
+bool zero_memory = true;
+#define ZERO_MEMORY_PERMS 0444
+#else
bool zero_memory;
+#define ZERO_MEMORY_PERMS 0644
+#endif
static int zero_memory_set(const char *arg, const struct kernel_param *kp)
{
.set = zero_memory_set,
};
-module_param_cb(zero_memory, &zero_memory_ops, &zero_memory, 0644);
+module_param_cb(zero_memory, &zero_memory_ops, &zero_memory, ZERO_MEMORY_PERMS);
u32 nvmap_max_handle_count;
#define __GFP_NVMAP (GFP_KERNEL | __GFP_HIGHMEM)
#endif
-#ifdef CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES
-#define NVMAP_ZEROED_PAGES __GFP_ZERO
-#else
-#define NVMAP_ZEROED_PAGES 0
-#endif
-
-#define GFP_NVMAP (__GFP_NVMAP | __GFP_NOWARN | NVMAP_ZEROED_PAGES)
-
-extern bool zero_memory;
+#define GFP_NVMAP (__GFP_NVMAP | __GFP_NOWARN)
#ifdef CONFIG_64BIT
#define NVMAP_LAZY_VFREE