ia64/xen-unstable

changeset 11882:12f7be674616

[ACM] Fix binary alignment in tools.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author kfraser@localhost.localdomain
date Wed Oct 18 17:29:08 2006 +0100 (2006-10-18)
parents 8190a4a7ea4d
children 7f861cd3d0c3
files tools/security/secpol_tool.c
line diff
     1.1 --- a/tools/security/secpol_tool.c	Wed Oct 18 17:24:36 2006 +0100
     1.2 +++ b/tools/security/secpol_tool.c	Wed Oct 18 17:29:08 2006 +0100
     1.3 @@ -43,6 +43,8 @@
     1.4  fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a ,	\
     1.5                  errno, strerror(errno))
     1.6  
     1.7 +#define ALIGN8(x)  (void *)(((long)(x) + 7) & ~7)
     1.8 +
     1.9  void usage(char *progname)
    1.10  {
    1.11      printf("Usage: %s ACTION\n"
    1.12 @@ -182,14 +184,14 @@ void acm_dump_policy_buffer(void *buf, i
    1.13             ntohl(pol->secondary_buffer_offset));
    1.14      switch (ntohl(pol->primary_policy_code)) {
    1.15      case ACM_CHINESE_WALL_POLICY:
    1.16 -        acm_dump_chinesewall_buffer(buf +
    1.17 -                                    ntohl(pol->primary_buffer_offset),
    1.18 +        acm_dump_chinesewall_buffer(ALIGN8(buf +
    1.19 +                                     ntohl(pol->primary_buffer_offset)),
    1.20                                      ntohl(pol->len) -
    1.21                                      ntohl(pol->primary_buffer_offset));
    1.22          break;
    1.23  
    1.24      case ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY:
    1.25 -        acm_dump_ste_buffer(buf + ntohl(pol->primary_buffer_offset),
    1.26 +        acm_dump_ste_buffer(ALIGN8(buf + ntohl(pol->primary_buffer_offset)),
    1.27                              ntohl(pol->len) -
    1.28                              ntohl(pol->primary_buffer_offset));
    1.29          break;
    1.30 @@ -204,14 +206,14 @@ void acm_dump_policy_buffer(void *buf, i
    1.31  
    1.32      switch (ntohl(pol->secondary_policy_code)) {
    1.33      case ACM_CHINESE_WALL_POLICY:
    1.34 -        acm_dump_chinesewall_buffer(buf +
    1.35 -                                    ntohl(pol->secondary_buffer_offset),
    1.36 +        acm_dump_chinesewall_buffer(ALIGN8(buf +
    1.37 +                                     ntohl(pol->secondary_buffer_offset)),
    1.38                                      ntohl(pol->len) -
    1.39                                      ntohl(pol->secondary_buffer_offset));
    1.40          break;
    1.41  
    1.42      case ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY:
    1.43 -        acm_dump_ste_buffer(buf + ntohl(pol->secondary_buffer_offset),
    1.44 +        acm_dump_ste_buffer(ALIGN8(buf + ntohl(pol->secondary_buffer_offset)),
    1.45                              ntohl(pol->len) -
    1.46                              ntohl(pol->secondary_buffer_offset));
    1.47          break;