netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 3c574_cs: fix operator precedence between << and &
@ 2013-01-17 17:18 Nickolai Zeldovich
  2013-01-17 20:05 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Nickolai Zeldovich @ 2013-01-17 17:18 UTC (permalink / raw)
  To: netdev; +Cc: Nickolai Zeldovich, linux-kernel

The code to print the FIFO size in tc574_config computes it as:

  8 << config & Ram_size

which evaluates the '<<' first, but the actual intent is to evaluate the
'&' first.  Add parentheses to enforce desired evaluation order.

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
---
 drivers/net/ethernet/3com/3c574_cs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/3com/3c574_cs.c b/drivers/net/ethernet/3com/3c574_cs.c
index 66df936..ffd8de2 100644
--- a/drivers/net/ethernet/3com/3c574_cs.c
+++ b/drivers/net/ethernet/3com/3c574_cs.c
@@ -432,7 +432,7 @@ static int tc574_config(struct pcmcia_device *link)
 	netdev_info(dev, "%s at io %#3lx, irq %d, hw_addr %pM\n",
 		    cardname, dev->base_addr, dev->irq, dev->dev_addr);
 	netdev_info(dev, " %dK FIFO split %s Rx:Tx, %sMII interface.\n",
-		    8 << config & Ram_size,
+		    8 << (config & Ram_size),
 		    ram_split[(config & Ram_split) >> Ram_split_shift],
 		    config & Autoselect ? "autoselect " : "");
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] 3c574_cs: fix operator precedence between << and &
  2013-01-17 17:18 [PATCH] 3c574_cs: fix operator precedence between << and & Nickolai Zeldovich
@ 2013-01-17 20:05 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-01-17 20:05 UTC (permalink / raw)
  To: nickolai; +Cc: netdev, linux-kernel

From: Nickolai Zeldovich <nickolai@csail.mit.edu>
Date: Thu, 17 Jan 2013 12:18:29 -0500

> The code to print the FIFO size in tc574_config computes it as:
> 
>   8 << config & Ram_size
> 
> which evaluates the '<<' first, but the actual intent is to evaluate the
> '&' first.  Add parentheses to enforce desired evaluation order.
> 
> Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-17 20:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-17 17:18 [PATCH] 3c574_cs: fix operator precedence between << and & Nickolai Zeldovich
2013-01-17 20:05 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).