lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1dc4fe03-be3b-7175-05aa-2f5397f57cb5@users.sourceforge.net>
Date:   Tue, 6 Feb 2018 17:19:01 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-input@...r.kernel.org,
        Benjamin Tissoires <benjamin.tissoires@...hat.com>,
        Jiri Kosina <jikos@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 3/3] HID: lenovo: Adjust four checks for null pointers

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 6 Feb 2018 17:02:53 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/hid/hid-lenovo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index f863b94f3476..ba128123466b 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -687,7 +687,7 @@ static int lenovo_probe_tpkbd(struct hid_device *hdev)
 	data_pointer = devm_kzalloc(&hdev->dev,
 				    sizeof(*data_pointer),
 				    GFP_KERNEL);
-	if (data_pointer == NULL) {
+	if (!data_pointer) {
 		ret = -ENOMEM;
 		goto err;
 	}
@@ -698,7 +698,7 @@ static int lenovo_probe_tpkbd(struct hid_device *hdev)
 
 	name_mute = devm_kzalloc(&hdev->dev, name_sz, GFP_KERNEL);
 	name_micmute = devm_kzalloc(&hdev->dev, name_sz, GFP_KERNEL);
-	if (name_mute == NULL || name_micmute == NULL) {
+	if (!name_mute || !name_micmute) {
 		hid_err(hdev, "Could not allocate memory for led data\n");
 		ret = -ENOMEM;
 		goto err;
@@ -823,7 +823,7 @@ static void lenovo_remove_tpkbd(struct hid_device *hdev)
 	 * Only the trackpoint half of the keyboard has drvdata and stuff that
 	 * needs unregistering.
 	 */
-	if (data_pointer == NULL)
+	if (!data_pointer)
 		return;
 
 	sysfs_remove_group(&hdev->dev.kobj,
-- 
2.16.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ