summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2014-09-22 00:02:01 +0100
committerDavid Howells <dhowells@redhat.com>2014-09-22 00:02:01 +0100
commitd1ac5540455c3a2a11e943e19e2dc044cebe147d (patch)
tree6599811a28a31242fb258afa74361ff425bb07d6 /Documentation
parentd3e4f41973753a7768a5728be53c7d9a3fdf86cb (diff)
downloadlwn-d1ac5540455c3a2a11e943e19e2dc044cebe147d.tar.gz
lwn-d1ac5540455c3a2a11e943e19e2dc044cebe147d.zip
KEYS: Check hex2bin()'s return when generating an asymmetric key ID
As it stands, the code to generate an asymmetric key ID prechecks the hex string it is given whilst determining the length, before it allocates the buffer for hex2bin() to translate into - which mean that checking the result of hex2bin() is redundant. Unfortunately, hex2bin() is marked as __must_check, which means that the following warning may be generated if the return value isn't checked: crypto/asymmetric_keys/asymmetric_type.c: In function asymmetric_key_hex_to_key_id: crypto/asymmetric_keys/asymmetric_type.c:110: warning: ignoring return value of hex2bin, declared with attribute warn_unused_result The warning can't be avoided by casting the result to void. Instead, use strlen() to check the length of the string and ignore the fact that the string might not be entirely valid hex until after the allocation has been done - in which case we can use the result of hex2bin() for this. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'Documentation')
0 files changed, 0 insertions, 0 deletions