Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0238507b authored by Stefan Richter's avatar Stefan Richter
Browse files

firewire: core: document fw_csr_string's truncation of long strings



fw_csr_string() truncates and terminates target strings like strlcpy()
does.  Unlike strlcpy(), it returns the target strlen, not the source
strlen, hence users of fw_csr_string() are unable to detect truncation.

Point this behavior out in the kerneldoc comment.

Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
Reviewed-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
parent 51b04d59
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -115,6 +115,9 @@ static int textual_leaf_to_string(const u32 *block, char *buf, size_t size)
 *
 * The string is taken from a minimal ASCII text descriptor leaf after
 * the immediate entry with @key.  The string is zero-terminated.
 * An overlong string is silently truncated such that it and the
 * zero byte fit into @size.
 *
 * Returns strlen(buf) or a negative error code.
 */
int fw_csr_string(const u32 *directory, int key, char *buf, size_t size)