.. | .. |
---|
1 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
---|
2 | 2 | /* |
---|
3 | 3 | * |
---|
4 | | - * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved. |
---|
| 4 | + * (C) COPYRIGHT 2019-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 |
---|
.. | .. |
---|
32 | 32 | /** |
---|
33 | 33 | * kbasep_serialize_bytes - serialize bytes to the message buffer |
---|
34 | 34 | * |
---|
35 | | - * Serialize bytes as is using memcpy() |
---|
36 | | - * |
---|
37 | 35 | * @buffer: Message buffer |
---|
38 | 36 | * @pos: Message buffer offset |
---|
39 | 37 | * @bytes: Bytes to serialize |
---|
40 | 38 | * @len: Length of bytes array |
---|
| 39 | + * |
---|
| 40 | + * Serialize bytes as if using memcpy(). |
---|
41 | 41 | * |
---|
42 | 42 | * Return: updated position in the buffer |
---|
43 | 43 | */ |
---|
.. | .. |
---|
58 | 58 | /** |
---|
59 | 59 | * kbasep_serialize_string - serialize string to the message buffer |
---|
60 | 60 | * |
---|
61 | | - * String is serialized as 4 bytes for string size, |
---|
62 | | - * then string content and then null terminator. |
---|
63 | | - * |
---|
64 | 61 | * @buffer: Message buffer |
---|
65 | 62 | * @pos: Message buffer offset |
---|
66 | 63 | * @string: String to serialize |
---|
67 | 64 | * @max_write_size: Number of bytes that can be stored in buffer |
---|
| 65 | + * |
---|
| 66 | + * String is serialized as 4 bytes for string size, |
---|
| 67 | + * then string content and then null terminator. |
---|
68 | 68 | * |
---|
69 | 69 | * Return: updated position in the buffer |
---|
70 | 70 | */ |
---|
.. | .. |
---|
84 | 84 | KBASE_DEBUG_ASSERT(max_write_size >= sizeof(string_len) + sizeof(char)); |
---|
85 | 85 | max_write_size -= sizeof(string_len); |
---|
86 | 86 | |
---|
87 | | - string_len = strlcpy( |
---|
| 87 | + string_len = strscpy( |
---|
88 | 88 | &buffer[pos + sizeof(string_len)], |
---|
89 | 89 | string, |
---|
90 | 90 | max_write_size); |
---|
.. | .. |
---|
102 | 102 | /** |
---|
103 | 103 | * kbasep_serialize_timestamp - serialize timestamp to the message buffer |
---|
104 | 104 | * |
---|
105 | | - * Get current timestamp using kbasep_get_timestamp() |
---|
106 | | - * and serialize it as 64 bit unsigned integer. |
---|
107 | | - * |
---|
108 | 105 | * @buffer: Message buffer |
---|
109 | 106 | * @pos: Message buffer offset |
---|
| 107 | + * |
---|
| 108 | + * Get current timestamp using kbasep_get_timestamp() |
---|
| 109 | + * and serialize it as 64 bit unsigned integer. |
---|
110 | 110 | * |
---|
111 | 111 | * Return: updated position in the buffer |
---|
112 | 112 | */ |
---|
.. | .. |
---|
121 | 121 | ×tamp, sizeof(timestamp)); |
---|
122 | 122 | } |
---|
123 | 123 | #endif /* _KBASE_TL_SERIALIZE_H */ |
---|
124 | | - |
---|