From patchwork Thu Jan 23 22:38:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Upinder Malhi (umalhi)" X-Patchwork-Id: 3532251 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1B943C02DC for ; Thu, 23 Jan 2014 22:38:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 41E0920161 for ; Thu, 23 Jan 2014 22:38:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 47FA2201C8 for ; Thu, 23 Jan 2014 22:38:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750826AbaAWWiI (ORCPT ); Thu, 23 Jan 2014 17:38:08 -0500 Received: from rcdn-iport-5.cisco.com ([173.37.86.76]:20492 "EHLO rcdn-iport-5.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753300AbaAWWiH convert rfc822-to-8bit (ORCPT ); Thu, 23 Jan 2014 17:38:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1375; q=dns/txt; s=iport; t=1390516687; x=1391726287; h=from:to:subject:date:message-id:content-id: content-transfer-encoding:mime-version; bh=On2DWaqNRQYpfBuxE2V1iRTKwx1z4kQcGhnX9almrfs=; b=fqwPu1nkpoam8fVtApjMFYyBNMsuSibBIJ6RC7Qvoh89kaIM2AsBjyGN Z9LMTth1Ime4mT8OflInPRsBhZudVV2mVfk5vyH8/JppSv4fuOF6yR6Ac cUiilHCjgtQuZhM6K7XxJvmOUZhrG7pPbrvlIehaALTRmoGg9kTjuz8il Y=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhUFAOWY4VKtJXG9/2dsb2JhbABagww4Vr1NFnSCLCcTUQE+QicEARKIBQ3HExeOHIQPgRQEmCOBMpBmgy2BaEI X-IronPort-AV: E=Sophos;i="4.95,709,1384300800"; d="scan'208";a="299340217" Received: from rcdn-core2-2.cisco.com ([173.37.113.189]) by rcdn-iport-5.cisco.com with ESMTP; 23 Jan 2014 22:38:06 +0000 Received: from xhc-aln-x12.cisco.com (xhc-aln-x12.cisco.com [173.36.12.86]) by rcdn-core2-2.cisco.com (8.14.5/8.14.5) with ESMTP id s0NMc5ab020341 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Thu, 23 Jan 2014 22:38:05 GMT Received: from xmb-rcd-x09.cisco.com ([169.254.9.230]) by xhc-aln-x12.cisco.com ([173.36.12.86]) with mapi id 14.03.0123.003; Thu, 23 Jan 2014 16:38:05 -0600 From: "Upinder Malhi (umalhi)" To: "linux-rdma@vger.kernel.org" , "roland@kernel.org Dreier" Subject: [PATCH for-next] IB/usnic: Fix smatch endianness error Thread-Topic: [PATCH for-next] IB/usnic: Fix smatch endianness error Thread-Index: AQHPGIvHN2i1giTaIk+bT22hwAcq4w== Date: Thu, 23 Jan 2014 22:38:04 +0000 Message-ID: <2FE80B3D-7377-4A6B-80CC-E9A1955E3CDE@cisco.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.155.161.43] Content-ID: <177E9B7020533444BCA7EAF6505CA404@emea.cisco.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Error reported at http://marc.info/?l=linux-rdma&m=138995755801039&w=2 Fix short to int cast for big endian systems. Signed-off-by: Upinder Malhi --- drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c index 7ecc606..f8dfd76 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c @@ -629,6 +629,7 @@ static int qp_grp_id_from_flow(struct usnic_ib_qp_grp_flow *qp_flow, { enum usnic_transport_type trans_type = qp_flow->trans_type; int err; + uint16_t port_num = 0; switch (trans_type) { case USNIC_TRANSPORT_ROCE_CUSTOM: @@ -637,9 +638,15 @@ static int qp_grp_id_from_flow(struct usnic_ib_qp_grp_flow *qp_flow, case USNIC_TRANSPORT_IPV4_UDP: err = usnic_transport_sock_get_addr(qp_flow->udp.sock, NULL, NULL, - (uint16_t *) id); + &port_num); if (err) return err; + /* + * Copy port_num to stack first and then to *id, + * so that the short to int cast works for little + * and big endian systems. + */ + *id = port_num; break; default: usnic_err("Unsupported transport %u\n", trans_type);