Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3284671ybb; Tue, 31 Mar 2020 02:05:20 -0700 (PDT) X-Google-Smtp-Source: ADFU+vviz5w9pwFuV65SLT4kRGbN6y2JmljY6kcOymTeH/hhucl4WsJL04pNPD/uGEmyJTwX5H1S X-Received: by 2002:a05:6830:1610:: with SMTP id g16mr11878380otr.358.1585645520072; Tue, 31 Mar 2020 02:05:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585645520; cv=none; d=google.com; s=arc-20160816; b=pAuV+SAyCv/MaASWcD9atTaqkuV3eKLf2WN6Zp47Cp4R+FOhzl0eWJDgNghD4Cevxr BpBZKKdsRfimmKENlUp355RhvVmfJ6AP72x61BV+XzAyqi4xwWKDf8Rn0MaOsu2LhEm6 5UI5faLW6YajKVUsSNwVPbgu/R41GStLHJ8wdWnwXRwvF4R9ePHFKQxRm0dl/Yhy639M al9gSDJEGj8ibcQBRDdEeZX+SxL0VfrJrBrzKwj+Ui/kRovki1mAw7qTGfyLkSwUkQL8 MgUv0zpHpq/I0Piixp4addQnIxiSoG/UGK8rqikG7jybnpJTPluUGhs1CovkvwLjPUlV Kwgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r9L7uHzDPrz66K/TRzHy/c3jjGcnhIUB9MuL+ZNKgnQ=; b=iclz92o885ZcoKBh+XRUyIoj1nnwY5kWDvKFFLD6dyzPrAGkI/HZV3SYaNGrVoSwWz r8cUcM7HGtQqWPw/RGvOYzaWWpV1BVmkzZRFXa+tkHSMdldjtW1LFZmvxIfMqtylqQSF HceFhRCydFkZDAdqBvyPBoPbPEQTQb0OF5y/LdhRoNxS+P5Avw0HUryLq/8XD6aAZcka QU4VGwnCv0Pt1xV42lLTt1nPbSm+50Bd0DOJezp/hd9FkvPnZ3hcXAkY06GeyrBwP518 j4t2TFz0L8q4t78suEEGpI58GFyyLjZFpW8T7FrQ5pVt1GMgmnNDg2U5Luf79glwG/7X tgwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SubkYtWU; 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 g1si7763505otp.268.2020.03.31.02.05.08; Tue, 31 Mar 2020 02:05:20 -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; dkim=pass header.i=@kernel.org header.s=default header.b=SubkYtWU; 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 S1730972AbgCaJEd (ORCPT + 99 others); Tue, 31 Mar 2020 05:04:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:45030 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730965AbgCaJEa (ORCPT ); Tue, 31 Mar 2020 05:04:30 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C67EB20675; Tue, 31 Mar 2020 09:04:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645470; bh=8eomCZrlpS/TCs3dRXpFrmJQOARXZnLrGcwtpcnyBwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SubkYtWUuVg/ndKFzhUi/iUQb3CyjMIby45qow77tLoqatZpgYFvRf0OCoVmc+gQC BjyZbuUW9WbXQOtOW+ChvL42y3YMGCWpT1ZQeTJBrTU0PSV+Rxz/+ytBWVchP9FTid 4kOOtNfTO1AoCx3b376zvIAYO2yO0RDwne8rFNg0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Hense , Roi Dayan , Saeed Mahameed , "David S. Miller" Subject: [PATCH 5.5 063/170] net/mlx5e: Fix endianness handling in pedit mask Date: Tue, 31 Mar 2020 10:57:57 +0200 Message-Id: <20200331085431.190535282@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sebastian Hense [ Upstream commit 404402abd5f90aa90a134eb9604b1750c1941529 ] The mask value is provided as 64 bit and has to be casted in either 32 or 16 bit. On big endian systems the wrong half was casted which resulted in an all zero mask. Fixes: 2b64beba0251 ("net/mlx5e: Support header re-write of partial fields in TC pedit offload") Signed-off-by: Sebastian Hense Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -2432,10 +2432,11 @@ static int offload_pedit_fields(struct p continue; if (f->field_bsize == 32) { - mask_be32 = *(__be32 *)&mask; + mask_be32 = (__be32)mask; mask = (__force unsigned long)cpu_to_le32(be32_to_cpu(mask_be32)); } else if (f->field_bsize == 16) { - mask_be16 = *(__be16 *)&mask; + mask_be32 = (__be32)mask; + mask_be16 = *(__be16 *)&mask_be32; mask = (__force unsigned long)cpu_to_le16(be16_to_cpu(mask_be16)); }