Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932482AbbBBC4D (ORCPT ); Sun, 1 Feb 2015 21:56:03 -0500 Received: from linuxhacker.ru ([217.76.32.60]:59832 "EHLO fiona.linuxhacker.ru" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S932167AbbBBCxU (ORCPT ); Sun, 1 Feb 2015 21:53:20 -0500 From: green@linuxhacker.ru To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger Cc: Linux Kernel Mailing List , Henri Doreau , Oleg Drokin Subject: [PATCH 10/20] staging/lustre/obdclass: Proper swabbing of llog_rec_tail. Date: Sun, 1 Feb 2015 21:52:09 -0500 Message-Id: <1422845539-26742-11-git-send-email-green@linuxhacker.ru> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422845539-26742-1-git-send-email-green@linuxhacker.ru> References: <1422845539-26742-1-git-send-email-green@linuxhacker.ru> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1752 Lines: 47 From: Henri Doreau A variable-length structure preceeds llog_rec_tail within an llog block. Thus cr_tail shouldn't be accessed directly as a structure member but its actual location should be computed dynamically. Signed-off-by: Henri Doreau Reviewed-on: http://review.whamcloud.com/11937 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5631 Reviewed-by: jacques-Charles Lafoucriere Reviewed-by: Andreas Dilger Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/obdclass/llog_swab.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/llog_swab.c b/drivers/staging/lustre/lustre/obdclass/llog_swab.c index d3ec90e..a2d5aa1 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_swab.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_swab.c @@ -168,7 +168,8 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec) } case CHANGELOG_REC: { - struct llog_changelog_rec *cr = (struct llog_changelog_rec *)rec; + struct llog_changelog_rec *cr = + (struct llog_changelog_rec *)rec; __swab16s(&cr->cr.cr_namelen); __swab16s(&cr->cr.cr_flags); @@ -188,6 +189,8 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec) } else { tail = &cr->cr_tail; } + tail = (struct llog_rec_tail *)((char *)tail + + cr->cr.cr_namelen); break; } case CHANGELOG_USER_REC: -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/