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: <20080702051000.GF32598@cs181140183.pp.htv.fi>
Date:	Wed, 2 Jul 2008 08:10:00 +0300
From:	Adrian Bunk <bunk@...sta.de>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	Larry.Finger@...inger.net, stefano.brivio@...imi.it,
	linville@...driver.com
Cc:	David Howells <dhowells@...hat.com>, torvalds@...uxfoundation.org,
	linux-am33-list@...hat.com, linux-kernel@...r.kernel.org,
	linux-wireless@...r.kernel.org
Subject: [RFC: 2.6 patch] remove the switch in b43legacy_dma_init()

On Mon, Jun 30, 2008 at 04:18:25PM -0700, Andrew Morton wrote:
> On Fri, 13 Jun 2008 14:09:58 +0100
> David Howells <dhowells@...hat.com> wrote:
> 
> > Provide __ucmpdi2() for MN10300 so that allmodconfig can be built.
> 
> Well...  x86 has this problem as well, and when it pops up we address
> it by going in and looking at the codesite which is generating the call
> and fixing it.  And I do mean "fixing", because it's often the case
> that the caller was doing something silly and inefficient.

In this case I'd blame the gcc 3.4 fork used by MN10300.

> So are you sure that we should do this, rather than massaging the
> callers?

Patch to fix the callers (if wanted) is below.

cu
Adrian


<--  snip  -->


The gcc 3.4 fork used to compile the MN10300 port emits unwanted 
__ucmpdi2() calls for this switch on a 64bit value.

Fix it by transforming the switch to equivalent "if ... else if ..."
statements.

Signed-off-by: Adrian Bunk <bunk@...nel.org>

---
a89c72d736986777b2cc4e07589aa46e957c15a5 
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index c990f87..794dc83 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -1028,19 +1028,15 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev)
 	enum b43legacy_dmatype type;
 
 	dmamask = supported_dma_mask(dev);
-	switch (dmamask) {
-	default:
-		B43legacy_WARN_ON(1);
-	case DMA_30BIT_MASK:
+
+	if (dmamask == DMA_30BIT_MASK)
 		type = B43legacy_DMA_30BIT;
-		break;
-	case DMA_32BIT_MASK:
+	else if (dmamask == DMA_32BIT_MASK)
 		type = B43legacy_DMA_32BIT;
-		break;
-	case DMA_64BIT_MASK:
+	else if (dmamask == DMA_64BIT_MASK)
 		type = B43legacy_DMA_64BIT;
-		break;
-	}
+	else
+		B43legacy_WARN_ON(1);
 
 	err = ssb_dma_set_mask(dev->dev, dmamask);
 	if (err) {

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