From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752928AbcGVDuG (ORCPT ); Thu, 21 Jul 2016 23:50:06 -0400 Received: from [160.91.203.10] ([160.91.203.10]:48963 "EHLO smtp1.ccs.ornl.gov" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752812AbcGVDuB (ORCPT ); Thu, 21 Jul 2016 23:50:01 -0400 From: James Simmons To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin Cc: Linux Kernel Mailing List , Lustre Development List , "John L. Hammond" , James Simmons Subject: [PATCH 46/58] staging: lustre: lmv: access lum_stripe_offset as little endian Date: Thu, 21 Jul 2016 22:44:39 -0400 Message-Id: <1469155491-15265-47-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1469155491-15265-1-git-send-email-jsimmons@infradead.org> References: <1469155491-15265-1-git-send-email-jsimmons@infradead.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John L. Hammond By the time that a struct lmv_user_md reaches lmv_placement_policy() it has already been converted to little endian. Therefore use the appropriate macros around accesses to this this field. This issue was found by rewriting the definition of struct lmv_user_md to use the __leXX typedefs and running sparse. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4738 Reviewed-on: http://review.whamcloud.com/9671 Reviewed-by: Dmitry Eremin Reviewed-by: Swapnil Pimpale Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 9e3d35a..5830fc1 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -1244,15 +1244,15 @@ static int lmv_placement_policy(struct obd_device *obd, struct lmv_user_md *lum; lum = op_data->op_data; - if (lum->lum_stripe_offset != (__u32)-1) { - *mds = lum->lum_stripe_offset; + if (le32_to_cpu(lum->lum_stripe_offset) != (__u32)-1) { + *mds = le32_to_cpu(lum->lum_stripe_offset); } else { /* * -1 means default, which will be in the same MDT with * the stripe */ *mds = op_data->op_mds; - lum->lum_stripe_offset = op_data->op_mds; + lum->lum_stripe_offset = cpu_to_le32(op_data->op_mds); } } else { /* -- 1.7.1