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]
Date:	Wed,  4 Nov 2015 09:37:06 +0530
From:	jaswinder.singh@...aro.org
To:	linux-kernel@...r.kernel.org
Cc:	lee.jones@...aro.org, sfr@...b.auug.org.au,
	Jassi Brar <jaswinder.singh@...aro.org>
Subject: [PATCH] mailbox: mailbox-test: avoid reading iomem twice

From: Jassi Brar <jaswinder.singh@...aro.org>

Don't pass mmio region as source to print_hex_dump() and then
again to memcpy_fromio(). Do it once and give print_hex_dump()
the buffer we just read the data in.

Signed-off-by: Jassi Brar <jaswinder.singh@...aro.org>
---
 drivers/mailbox/mailbox-test.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
index f82dc89..684ae17 100644
--- a/drivers/mailbox/mailbox-test.c
+++ b/drivers/mailbox/mailbox-test.c
@@ -221,11 +221,10 @@ static void mbox_test_receive_message(struct mbox_client *client, void *message)
 
 	spin_lock_irqsave(&tdev->lock, flags);
 	if (tdev->mmio) {
+		memcpy_fromio(tdev->rx_buffer, tdev->mmio, MBOX_MAX_MSG_LEN);
 		print_hex_dump(KERN_INFO, "Client: Received [MMIO]: ",
 			       DUMP_PREFIX_ADDRESS, MBOX_BYTES_PER_LINE, 1,
-			       __io_virt(tdev->mmio), MBOX_MAX_MSG_LEN, true);
-		memcpy_fromio(tdev->rx_buffer, tdev->mmio, MBOX_MAX_MSG_LEN);
-
+			       tdev->rx_buffer, MBOX_MAX_MSG_LEN, true);
 	} else if (message) {
 		print_hex_dump(KERN_INFO, "Client: Received [API]: ",
 			       DUMP_PREFIX_ADDRESS, MBOX_BYTES_PER_LINE, 1,
-- 
1.9.1

--
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