mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
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:
committed by
mobile promotions
parent
7435d5749a
commit
d75309658f
@@ -6,6 +6,7 @@ LINUXINCLUDE += -I$(srctree.nvidia-oot)/include
|
|||||||
obj-m += hwmon/
|
obj-m += hwmon/
|
||||||
obj-m += mfd/
|
obj-m += mfd/
|
||||||
obj-m += pinctrl/
|
obj-m += pinctrl/
|
||||||
|
obj-m += platform/tegra/
|
||||||
obj-m += pwm/
|
obj-m += pwm/
|
||||||
obj-m += thermal/
|
obj-m += thermal/
|
||||||
obj-m += watchdog/
|
obj-m += watchdog/
|
||||||
|
|||||||
4
drivers/platform/tegra/Makefile
Normal file
4
drivers/platform/tegra/Makefile
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
||||||
|
|
||||||
|
obj-m += bad.o
|
||||||
23
drivers/platform/tegra/bad.c
Normal file
23
drivers/platform/tegra/bad.c
Normal 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");
|
||||||
Reference in New Issue
Block a user