hc
2024-05-16 8d2a02b24d66aa359e83eebc1ed3c0f85367a1cb
kernel/drivers/gpu/arm/bifrost/ipa/mali_kbase_ipa_debugfs.c
....@@ -1,7 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
22 /*
33 *
4
- * (C) COPYRIGHT 2017-2021 ARM Limited. All rights reserved.
4
+ * (C) COPYRIGHT 2017-2022 ARM Limited. All rights reserved.
55 *
66 * This program is free software and is provided to you under the terms of the
77 * GNU General Public License version 2 as published by the Free Software
....@@ -26,10 +26,6 @@
2626 #include "mali_kbase.h"
2727 #include "mali_kbase_ipa.h"
2828 #include "mali_kbase_ipa_debugfs.h"
29
-
30
-#if (KERNEL_VERSION(4, 7, 0) > LINUX_VERSION_CODE)
31
-#define DEFINE_DEBUGFS_ATTRIBUTE DEFINE_SIMPLE_ATTRIBUTE
32
-#endif
3329
3430 struct kbase_ipa_model_param {
3531 char *name;
....@@ -128,8 +124,14 @@
128124
129125 err = kbase_ipa_model_recalculate(model);
130126 if (err < 0) {
127
+ u32 string_len = strscpy(param->addr.str, old_str, param->size);
128
+
129
+ string_len += sizeof(char);
130
+ /* Make sure that the source string fit into the buffer. */
131
+ KBASE_DEBUG_ASSERT(string_len <= param->size);
132
+ CSTD_UNUSED(string_len);
133
+
131134 ret = err;
132
- strlcpy(param->addr.str, old_str, param->size);
133135 }
134136
135137 end:
....@@ -247,7 +249,7 @@
247249 dir = debugfs_create_dir(model->ops->name,
248250 model->kbdev->mali_debugfs_directory);
249251
250
- if (!dir) {
252
+ if (IS_ERR_OR_NULL(dir)) {
251253 dev_err(model->kbdev->dev,
252254 "Couldn't create mali debugfs %s directory",
253255 model->ops->name);
....@@ -275,7 +277,7 @@
275277 "Type not set for %s parameter %s\n",
276278 model->ops->name, param->name);
277279 } else {
278
- debugfs_create_file(param->name, S_IRUGO | S_IWUSR,
280
+ debugfs_create_file(param->name, 0644,
279281 dir, param, fops);
280282 }
281283 }