Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Dec 2018 12:31:57 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r341949 - stable/12/sys/dev/mlx5/mlx5_ib
Message-ID:  <201812121231.wBCCVvCH082358@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Dec 12 12:31:57 2018
New Revision: 341949
URL: https://svnweb.freebsd.org/changeset/base/341949

Log:
  MFC r341568:
  mlx5ib: Fix sign extension in mlx5_ib_query_device
  
  "fw_rev_min(dev->mdev)" with type "unsigned short" (16 bits, unsigned) is
  promoted in "fw_rev_min(dev->mdev) << 16" to type "int" (32 bits, signed), then
  sign-extended to type "unsigned long" (64 bits, unsigned). If
  "fw_rev_min(dev->mdev) << 16" is greater than 0x7FFFFFFF, the upper bits of the
  result will all be 1.
  
  Sponsored by:   Mellanox Technologies

Modified:
  stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c	Wed Dec 12 12:30:51 2018	(r341948)
+++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c	Wed Dec 12 12:31:57 2018	(r341949)
@@ -605,7 +605,7 @@ static int mlx5_ib_query_device(struct ib_device *ibde
 		return err;
 
 	props->fw_ver = ((u64)fw_rev_maj(dev->mdev) << 32) |
-		(fw_rev_min(dev->mdev) << 16) |
+		((u32)fw_rev_min(dev->mdev) << 16) |
 		fw_rev_sub(dev->mdev);
 	props->device_cap_flags    = IB_DEVICE_CHANGE_PHY_PORT |
 		IB_DEVICE_PORT_ACTIVE_EVENT		|



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812121231.wBCCVvCH082358>