diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-05-22 08:42:28 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2017-05-22 10:23:41 +0200 |
commit | 5d4acfc1411050d9a105a04bea4915a68d41071d (patch) | |
tree | 18dc9e1a288904633defe4605d915410e85d154b /net/bluetooth | |
parent | 5bd425aa2b9c3e11e6a01c623ef70b39cb029ca1 (diff) | |
download | linux-rpi-5d4acfc1411050d9a105a04bea4915a68d41071d.tar.gz linux-rpi-5d4acfc1411050d9a105a04bea4915a68d41071d.tar.bz2 linux-rpi-5d4acfc1411050d9a105a04bea4915a68d41071d.zip |
Bluetooth: Delete error messages for failed memory allocations in two functions
Omit two extra messages for memory allocation failures in these functions.
This issue was detected by using the Coccinelle software.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/ecdh_helper.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/net/bluetooth/ecdh_helper.c b/net/bluetooth/ecdh_helper.c index 24d4e60f8c48..c7b1a9aee579 100644 --- a/net/bluetooth/ecdh_helper.c +++ b/net/bluetooth/ecdh_helper.c @@ -89,11 +89,9 @@ bool compute_ecdh_secret(const u8 public_key[64], const u8 private_key[32], p.curve_id = ECC_CURVE_NIST_P256; buf_len = crypto_ecdh_key_len(&p); buf = kmalloc(buf_len, GFP_KERNEL); - if (!buf) { - pr_err("alg: kpp: Failed to allocate %d bytes for buf\n", - buf_len); + if (!buf) goto free_req; - } + crypto_ecdh_encode_key(buf, buf_len, &p); /* Set A private Key */ @@ -170,11 +168,8 @@ bool generate_ecdh_keys(u8 public_key[64], u8 private_key[32]) p.key_size = 32; buf_len = crypto_ecdh_key_len(&p); buf = kmalloc(buf_len, GFP_KERNEL); - if (!buf) { - pr_err("alg: kpp: Failed to allocate %d bytes for buf\n", - buf_len); + if (!buf) goto free_req; - } do { if (tries++ >= max_tries) |