| .. | .. |
|---|
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note |
|---|
| 2 | 2 | /* |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * (C) COPYRIGHT 2017-2021 ARM Limited. All rights reserved. |
|---|
| 4 | + * (C) COPYRIGHT 2017-2022 ARM Limited. All rights reserved. |
|---|
| 5 | 5 | * |
|---|
| 6 | 6 | * This program is free software and is provided to you under the terms of the |
|---|
| 7 | 7 | * GNU General Public License version 2 as published by the Free Software |
|---|
| .. | .. |
|---|
| 26 | 26 | #include "mali_kbase.h" |
|---|
| 27 | 27 | #include "mali_kbase_ipa.h" |
|---|
| 28 | 28 | #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 |
|---|
| 33 | 29 | |
|---|
| 34 | 30 | struct kbase_ipa_model_param { |
|---|
| 35 | 31 | char *name; |
|---|
| .. | .. |
|---|
| 128 | 124 | |
|---|
| 129 | 125 | err = kbase_ipa_model_recalculate(model); |
|---|
| 130 | 126 | 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 | + |
|---|
| 131 | 134 | ret = err; |
|---|
| 132 | | - strlcpy(param->addr.str, old_str, param->size); |
|---|
| 133 | 135 | } |
|---|
| 134 | 136 | |
|---|
| 135 | 137 | end: |
|---|
| .. | .. |
|---|
| 247 | 249 | dir = debugfs_create_dir(model->ops->name, |
|---|
| 248 | 250 | model->kbdev->mali_debugfs_directory); |
|---|
| 249 | 251 | |
|---|
| 250 | | - if (!dir) { |
|---|
| 252 | + if (IS_ERR_OR_NULL(dir)) { |
|---|
| 251 | 253 | dev_err(model->kbdev->dev, |
|---|
| 252 | 254 | "Couldn't create mali debugfs %s directory", |
|---|
| 253 | 255 | model->ops->name); |
|---|
| .. | .. |
|---|
| 275 | 277 | "Type not set for %s parameter %s\n", |
|---|
| 276 | 278 | model->ops->name, param->name); |
|---|
| 277 | 279 | } else { |
|---|
| 278 | | - debugfs_create_file(param->name, S_IRUGO | S_IWUSR, |
|---|
| 280 | + debugfs_create_file(param->name, 0644, |
|---|
| 279 | 281 | dir, param, fops); |
|---|
| 280 | 282 | } |
|---|
| 281 | 283 | } |
|---|