diff options
| author | Henri Doreau <henri.doreau@cea.fr> | 2015-02-01 21:52:09 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-02-07 04:31:10 -0500 |
| commit | dbab2d8563d8a988dd4ec740ab9c06a4f86890ea (patch) | |
| tree | 8b6fb3e954b5f708434695253f8c848b59717d3f /drivers | |
| parent | 081fa9dffcde7c9fc4d9fdf18fe277dfa3f675aa (diff) | |
staging/lustre/obdclass: Proper swabbing of llog_rec_tail.
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 <henri.doreau@cea.fr>
Reviewed-on: http://review.whamcloud.com/11937
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5631
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/staging/lustre/lustre/obdclass/llog_swab.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/lustre/lustre/obdclass/llog_swab.c b/drivers/staging/lustre/lustre/obdclass/llog_swab.c index d3ec90e85eb9..a2d5aa105d6b 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) | |||
| 168 | } | 168 | } |
| 169 | case CHANGELOG_REC: | 169 | case CHANGELOG_REC: |
| 170 | { | 170 | { |
| 171 | struct llog_changelog_rec *cr = (struct llog_changelog_rec *)rec; | 171 | struct llog_changelog_rec *cr = |
| 172 | (struct llog_changelog_rec *)rec; | ||
| 172 | 173 | ||
| 173 | __swab16s(&cr->cr.cr_namelen); | 174 | __swab16s(&cr->cr.cr_namelen); |
| 174 | __swab16s(&cr->cr.cr_flags); | 175 | __swab16s(&cr->cr.cr_flags); |
| @@ -188,6 +189,8 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec) | |||
| 188 | } else { | 189 | } else { |
| 189 | tail = &cr->cr_tail; | 190 | tail = &cr->cr_tail; |
| 190 | } | 191 | } |
| 192 | tail = (struct llog_rec_tail *)((char *)tail + | ||
| 193 | cr->cr.cr_namelen); | ||
| 191 | break; | 194 | break; |
| 192 | } | 195 | } |
| 193 | case CHANGELOG_USER_REC: | 196 | case CHANGELOG_USER_REC: |
