Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4412853yba; Mon, 29 Apr 2019 20:21:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7S71O1Zd0tI1UiZkegqPhQgdrpQWBC6b6swEUyZuVtlJXmvhIp1tam3E9MOPcQ6hODvEF X-Received: by 2002:a63:c64c:: with SMTP id x12mr13894640pgg.379.1556594478436; Mon, 29 Apr 2019 20:21:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556594478; cv=none; d=google.com; s=arc-20160816; b=RuhmgUs6272aQOT6y3yVT36x4y6aJEGlngxHTWcw1bICDvmfUDhVoyD6c8hKB2Yqxd 2J4mr/zwwF8m9kEICH7iw+ZarrCs8yt6GuUtLLgJkHuIGld+DXTg1r1meaTenVv3DIU9 CsLiLlw6MnL/1QHxPQIdeG84pX6a62RS73X088epoSvFU6rZbrYLihRSSzsyy8C7UTlK b5TgiJq4P++Zb0V9tnHFWGgJfFxNtj6uImhqzonF2/pTKFC/hBDxFhPdTDB9Q2pEfDbC Lwp4/fUqXSN/31M6Tbu/VImmb8YO0IQ0zt1Ng1AOdaxrQN94bMu0koL+3YmNQ7Ecufh0 Emrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=pXz61UAJjBIy7+518aMjSWj5pEsyyaUzsXmfE9VjvqQ=; b=RrxdxJ6xsvM4SbOCSIM69C5xm1hTLbzXG2YEGEfN4UEBxsjot6cjECbaPol457o3zN M0R7FHxQeB6usHzou3k11/B9mjl3P++Lc6nJJcscduIlFzO60SdVuWl0JiwoTY4ymiyB JItKF/WwdQVshlaTgSkZFvaFisTkIM2oI4vcJSNV8TWkWKcAAH1D2dDEgsdVK9gVWVkT yAFT7F7fBzhBTCYYWoN7egfVeesn1FimmNHJWUJ6b0PX8bc0kxB3UjFreDYWEMJLui2J TJ+XrmhJ0rvyx8+bTMTnb2SMKdT1DGmk9YEUAFGYulYOddZNwSiSYrVJQq0GCKM4gGJ2 Hq8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh3si5292754plb.284.2019.04.29.20.21.02; Mon, 29 Apr 2019 20:21:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730049AbfD3DTB (ORCPT + 99 others); Mon, 29 Apr 2019 23:19:01 -0400 Received: from www.osadl.org ([62.245.132.105]:53929 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729931AbfD3DTB (ORCPT ); Mon, 29 Apr 2019 23:19:01 -0400 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id x3U3IZKT005484; Tue, 30 Apr 2019 05:18:35 +0200 From: Nicholas Mc Guire To: Santosh Shilimkar Cc: "David S. Miller" , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH V2] rds: ib: force endiannes annotation Date: Tue, 30 Apr 2019 05:12:57 +0200 Message-Id: <1556593977-15828-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While the endiannes is being handled correctly as indicated by the comment above the offending line - sparse was unhappy with the missing annotation as be64_to_cpu() expects a __be64 argument. To mitigate this annotation all involved variables are changed to a consistent __le64 and the conversion to uint64_t delayed to the call to rds_cong_map_updated(). Signed-off-by: Nicholas Mc Guire --- Problem located by an experimental coccinelle script to locate patters that make sparse unhappy (false positives): net/rds/ib_recv.c:827:23: warning: cast to restricted __le64 V2: Edward Cree rejected the need for using __force here - instead solve the sparse issue by updating all of the involved variables - which results in an identical binary as well without using the __force "solution" to the sparse warning. Thanks ! Patch was compile-tested with: x86_64_defconfig + INFINIBAND=m, RDS_RDMA=m Patch was verified not to change the binary by diffing the generated object code before and after applying the patch. Patch is against 5.1-rc6 (localversion-next is 20190429) net/rds/ib_recv.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c index 7055985..8946c89 100644 --- a/net/rds/ib_recv.c +++ b/net/rds/ib_recv.c @@ -772,7 +772,7 @@ static void rds_ib_cong_recv(struct rds_connection *conn, unsigned long frag_off; unsigned long to_copy; unsigned long copied; - uint64_t uncongested = 0; + __le64 uncongested = 0; void *addr; /* catch completely corrupt packets */ @@ -789,7 +789,7 @@ static void rds_ib_cong_recv(struct rds_connection *conn, copied = 0; while (copied < RDS_CONG_MAP_BYTES) { - uint64_t *src, *dst; + __le64 *src, *dst; unsigned int k; to_copy = min(RDS_FRAG_SIZE - frag_off, PAGE_SIZE - map_off); @@ -824,9 +824,7 @@ static void rds_ib_cong_recv(struct rds_connection *conn, } /* the congestion map is in little endian order */ - uncongested = le64_to_cpu(uncongested); - - rds_cong_map_updated(map, uncongested); + rds_cong_map_updated(map, le64_to_cpu(uncongested)); } static void rds_ib_process_recv(struct rds_connection *conn, -- 2.1.4