mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
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
24 lines
517 B
C
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");
|