Files
linux-nv-oot/drivers/platform/tegra/bad.c
Laxman Dewangan d75309658f 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
2022-05-01 09:26:28 -07:00

24 lines
517 B
C

// 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");