diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2014-11-19 05:52:00 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2014-12-10 14:53:02 -0500 |
commit | 0238507b951857360461b0635111e7376ffd44d1 (patch) | |
tree | c6952e34b302fc2f3fac4fbdcffa369bf264d611 | |
parent | 51b04d59c27430a57c347b55478415c342009035 (diff) |
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: Stefan Richter <stefanr@s5r6.in-berlin.de>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r-- | drivers/firewire/core-device.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index 2c6d5e118ac1..f9e3aee6a211 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c | |||
@@ -115,6 +115,9 @@ static int textual_leaf_to_string(const u32 *block, char *buf, size_t size) | |||
115 | * | 115 | * |
116 | * The string is taken from a minimal ASCII text descriptor leaf after | 116 | * The string is taken from a minimal ASCII text descriptor leaf after |
117 | * the immediate entry with @key. The string is zero-terminated. | 117 | * the immediate entry with @key. The string is zero-terminated. |
118 | * An overlong string is silently truncated such that it and the | ||
119 | * zero byte fit into @size. | ||
120 | * | ||
118 | * Returns strlen(buf) or a negative error code. | 121 | * Returns strlen(buf) or a negative error code. |
119 | */ | 122 | */ |
120 | int fw_csr_string(const u32 *directory, int key, char *buf, size_t size) | 123 | int fw_csr_string(const u32 *directory, int key, char *buf, size_t size) |