summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorzy <[email protected]>2023-12-01 04:59:56 -0500
committerzy <[email protected]>2023-12-01 04:59:56 -0500
commit0d1f57f06ea5c63d17edd98355da3733345ecc01 (patch)
tree76b52e56602b4fc7cdf8ba0528389607c97edea4 /source
parent21862f1271acad91e1ff3a33deda1751fc57dfb7 (diff)
fix bug get_timer
Diffstat (limited to 'source')
-rw-r--r--source/module/monitor_kernel.c5
-rw-r--r--source/module/monitor_kernel_lib.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/source/module/monitor_kernel.c b/source/module/monitor_kernel.c
index 06c334d..bf0d872 100644
--- a/source/module/monitor_kernel.c
+++ b/source/module/monitor_kernel.c
@@ -69,7 +69,10 @@ static long device_ioctl(struct file *file, unsigned int ioctl_num,
warg.time_ns =
warg.time_ns == 0 ? def_interval_ns : warg.time_ns; // default 10us
// start watch variable
- start_watch_variable(warg);
+ ret = start_watch_variable(warg);
+ if (ret) {
+ printk(KERN_INFO "start_watch_variable failed\n");
+ }
break;
case IOCTL_DUMP_LOG:
printk(KERN_INFO "variable_monitor IOCTL_DUMP_LOG\n");
diff --git a/source/module/monitor_kernel_lib.c b/source/module/monitor_kernel_lib.c
index 68ed9ad..ade2616 100644
--- a/source/module/monitor_kernel_lib.c
+++ b/source/module/monitor_kernel_lib.c
@@ -239,7 +239,7 @@ int monitor_init(void) {
if (ret)
return ret;
//!todo
- ret = init_buffer(512 * 1024 * 1024); // 512M
+ ret = init_buffer(256 * 1024 * 1024); // 512M
if (ret)
return -1;
return 0;
@@ -284,6 +284,11 @@ int start_watch_variable(watch_arg warg) {
w_arg2k_w_arg(kptr, warg, &k_watch_arg);
timer = get_timer(warg.time_ns); // get a valuable timer
+ if (timer == NULL) {
+ printk(KERN_ERR "Timer is full\n");
+ return -1;
+ }
+
INIT_WORK(&timer->wk, diag_task_info_work);
printk(KERN_INFO "ptr transform kptr: %p\n", kptr);