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] [thread-next>] [day] [month] [year] [list]
Message-ID: <99ff298b-0caa-9f47-d7db-57b6fbd69360@users.sourceforge.net>
Date:   Sun, 18 Sep 2016 08:22:46 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux1394-devel@...ts.sourceforge.net,
        Stefan Richter <stefanr@...6.in-berlin.de>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 10/10] firewire-net: Adjust checks for null pointers in five
 functions

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sun, 18 Sep 2016 07:48:56 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script "checkpatch.pl" can point 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/firewire/net.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index eb7ce5e..e313be3 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -366,13 +366,13 @@ static struct fwnet_partial_datagram *fwnet_pd_new(struct net_device *net,
 
 	INIT_LIST_HEAD(&new->fi_list);
 	fi = fwnet_frag_new(new, frag_off, frag_len);
-	if (fi == NULL)
+	if (!fi)
 		goto free_new;
 
 	new->datagram_label = datagram_label;
 	new->datagram_size = dg_size;
 	new->skb = dev_alloc_skb(dg_size + LL_RESERVED_SPACE(net));
-	if (new->skb == NULL)
+	if (!new->skb)
 		goto free_fragment_info;
 
 	skb_reserve(new->skb, LL_RESERVED_SPACE(net));
@@ -418,7 +418,7 @@ static bool fwnet_pd_update(struct fwnet_peer *peer,
 		struct fwnet_partial_datagram *pd, void *frag_buf,
 		unsigned frag_off, unsigned frag_len)
 {
-	if (fwnet_frag_new(pd, frag_off, frag_len) == NULL)
+	if (!fwnet_frag_new(pd, frag_off, frag_len))
 		return false;
 
 	memcpy(pd->pbuf + frag_off, frag_buf, frag_len);
@@ -623,7 +623,7 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len,
 	}
 
 	pd = fwnet_pd_find(peer, datagram_label);
-	if (pd == NULL) {
+	if (!pd) {
 		while (peer->pdg_size >= FWNET_MAX_FRAGMENTS) {
 			/* remove the oldest */
 			fwnet_pd_delete(list_first_entry(&peer->pd_list,
@@ -632,7 +632,7 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len,
 		}
 		pd = fwnet_pd_new(net, peer, datagram_label,
 				  dg_size, buf, fg_off, len);
-		if (pd == NULL) {
+		if (!pd) {
 			retval = -ENOMEM;
 			goto unlock;
 		}
@@ -647,7 +647,7 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len,
 			fwnet_pd_delete(pd);
 			pd = fwnet_pd_new(net, peer, datagram_label,
 					  dg_size, buf, fg_off, len);
-			if (pd == NULL) {
+			if (!pd) {
 				peer->pdg_size--;
 				retval = -ENOMEM;
 				goto unlock;
@@ -1229,7 +1229,7 @@ static netdev_tx_t fwnet_tx(struct sk_buff *skb, struct net_device *net)
 	}
 
 	ptask = kmem_cache_alloc(fwnet_packet_task_cache, GFP_ATOMIC);
-	if (ptask == NULL)
+	if (!ptask)
 		goto unlock;
 
 	skb = skb_share_check(skb, GFP_ATOMIC);
@@ -1443,7 +1443,7 @@ static int fwnet_probe(struct fw_unit *unit,
 
 	net = alloc_netdev(sizeof(*dev), "firewire%d", NET_NAME_UNKNOWN,
 			   fwnet_init_dev);
-	if (net == NULL) {
+	if (!net) {
 		mutex_unlock(&fwnet_device_mutex);
 		return -ENOMEM;
 	}
-- 
2.10.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ