Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1646553 > unrolled thread

[PATCH] Bluetooth: Delete error messages for failed memory allocations in two functions

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-05-22 09:00 +0200
Last post2017-05-22 10:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] Bluetooth: Delete error messages for failed memory  allocations in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-22 09:00 +0200
    Re: [PATCH] Bluetooth: Delete error messages for failed memory  allocations in two functions Marcel Holtmann <marcel@holtmann.org> - 2017-05-22 10:30 +0200

#1646553 — [PATCH] Bluetooth: Delete error messages for failed memory allocations in two functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-22 09:00 +0200
Subject[PATCH] Bluetooth: Delete error messages for failed memory allocations in two functions
Message-ID<tJPtT-22Z-1@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 22 May 2017 08:42:28 +0200

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>
---
 net/bluetooth/ecdh_helper.c | 11 +++--------
 1 file 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
@@ -92,8 +92,6 @@ bool compute_ecdh_secret(const u8 public_key[64], const u8 private_key[32],
-	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 */
@@ -173,8 +171,5 @@ bool generate_ecdh_keys(u8 public_key[64], u8 private_key[32])
-	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)
-- 
2.13.0

[toc] | [next] | [standalone]


#1646602

FromMarcel Holtmann <marcel@holtmann.org>
Date2017-05-22 10:30 +0200
Message-ID<tJQT0-34Q-9@gated-at.bofh.it>
In reply to#1646553
Hallo Markus,

> 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>
> ---
> net/bluetooth/ecdh_helper.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web