platform/tegra: Add bad driver for memory access check

Add bad driver which check the memory access more than
allocated size.

Bug 3625675

Change-Id: Iad248a00f3c0f6b71ea060a9e5475123cd893bc2
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2705394
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Laxman Dewangan
2022-04-30 05:31:04 +00:00
committed by mobile promotions
parent 7435d5749a
commit d75309658f
3 changed files with 28 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ LINUXINCLUDE += -I$(srctree.nvidia-oot)/include
obj-m += hwmon/
obj-m += mfd/
obj-m += pinctrl/
obj-m += platform/tegra/
obj-m += pwm/
obj-m += thermal/
obj-m += watchdog/

View File

@@ -0,0 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
obj-m += bad.o

View File

@@ -0,0 +1,23 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022, NVIDIA CORPORATION, All rights reserved.
#include <linux/module.h>
#include <linux/random.h>
#include <linux/string.h>
int __init bad_access(void)
{
static const char source[] = "Twenty characters!!!";
char dest[10];
strncpy(dest, source, strlen(source));
pr_err("%s\n", dest);
return 0;
}
module_init(bad_access);
MODULE_AUTHOR("Dmitry Pervushin <dpervushin@nvidia.com>");
MODULE_DESCRIPTION("Tegra bad access driver");
MODULE_LICENSE("GPL v2");