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-next>] [day] [month] [year] [list]
Message-Id: <1446328980-1016-1-git-send-email-brutallesale@gmail.com>
Date:	Sat, 31 Oct 2015 23:03:00 +0100
From:	Bogicevic Sasa <brutallesale@...il.com>
To:	gregkh@...uxfoundation.org
Cc:	linux-kernel@...r.kernel.org,
	Bogicevic Sasa <brutallesale@...il.com>
Subject: [PATCH] drivers:staging:gdm72xx Fix increment in a loop

This fixes increment of pos int to be more readable
Lines 	qcb->csr[index].srcport_lo = ((buf[pos++]<<8)&0xff00);
	qcb->csr[index].srcport_lo += buf[pos++];
become
	qcb->csr[index].srcport_lo = get_unaligned_le16(&buf[pos]);
	pos += 2;

Signed-off-by: Bogicevic Sasa <brutallesale@...il.com>
---
 drivers/staging/gdm72xx/gdm_qos.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c
index 44d04bd..132789c 100644
--- a/drivers/staging/gdm72xx/gdm_qos.c
+++ b/drivers/staging/gdm72xx/gdm_qos.c
@@ -406,14 +406,14 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size)
 		qcb->csr[index].ipdst_addr[1] = buf[pos++];
 		qcb->csr[index].ipdst_addr[2] = buf[pos++];
 		qcb->csr[index].ipdst_addr[3] = buf[pos++];
-		qcb->csr[index].srcport_lo = ((buf[pos++] << 8) & 0xff00);
-		qcb->csr[index].srcport_lo += buf[pos++];
-		qcb->csr[index].srcport_hi = ((buf[pos++] << 8) & 0xff00);
-		qcb->csr[index].srcport_hi += buf[pos++];
-		qcb->csr[index].dstport_lo = ((buf[pos++] << 8) & 0xff00);
-		qcb->csr[index].dstport_lo += buf[pos++];
-		qcb->csr[index].dstport_hi = ((buf[pos++] << 8) & 0xff00);
-		qcb->csr[index].dstport_hi += buf[pos++];
+		qcb->csr[index].srcport_lo = get_unaligned_le16(&buf[pos]);
+		pos += 2;
+		qcb->csr[index].srcport_hi = get_unaligned_le16(&buf[pos]);
+		pos += 2;
+		qcb->csr[index].dstport_lo = get_unaligned_le16(&buf[pos]);
+		pos += 2;
+		qcb->csr[index].dstport_hi = get_unaligned_le16(&buf[pos]);
+		pos += 2;
 
 		qcb->qos_limit_size = 254 / qcb->qos_list_cnt;
 		spin_unlock_irqrestore(&qcb->qos_lock, flags);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ