diff mbox

IB/mlx4: fix unitialised variable is_mcast

Message ID 1400366024-18781-1-git-send-email-colin.king@canonical.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Colin King May 17, 2014, 10:33 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Commit 297e0dad7 introduced a bug where is_mcast is now
no longer initiialised on the non-multicast condition and so
it can be any random value from the stack.  This issue was
detected by cppcheck:

[drivers/infiniband/hw/mlx4/ah.c:103]: (error) Uninitialized
  variable: is_mcast

Simple fix is to initialise is_mcast to zero.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/infiniband/hw/mlx4/ah.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/infiniband/hw/mlx4/ah.c b/drivers/infiniband/hw/mlx4/ah.c
index 170dca6..2d8c339 100644
--- a/drivers/infiniband/hw/mlx4/ah.c
+++ b/drivers/infiniband/hw/mlx4/ah.c
@@ -73,7 +73,7 @@  static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr
 {
 	struct mlx4_ib_dev *ibdev = to_mdev(pd->device);
 	struct mlx4_dev *dev = ibdev->dev;
-	int is_mcast;
+	int is_mcast = 0;
 	struct in6_addr in6;
 	u16 vlan_tag;