From: John L. Hammond Date: Tue, 16 Aug 2016 20:18:41 +0000 (-0400) Subject: staging: lustre: lmv: access lum_stripe_offset as little endian X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5e01c959b1ecf7d8bfa16d53ed2e010dd087c097;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: lustre: lmv: access lum_stripe_offset as little endian 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index c005a66e06e7..59299949c7f4 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -1242,15 +1242,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 { /*