[PATCH 1/1] UBUNTU: AppArmor: fix argument size missmatch on 64 bit builds

Tim Gardner tim.gardner at canonical.com
Thu Jul 23 12:14:05 UTC 2009


Andy Whitcroft wrote:
> When building AppArmor on 64 bit we see a warning as below:
> 
>   .../apparmor/policy_interface.c: In function ‘audit_cb’:
>   .../apparmor/policy_interface.c:101: warning: format ‘%d’ expects type
>                                 ‘int’, but argument 3 has type ‘long int’
> 
> This is triggered by the log format below.  We are printing the
> difference
> between two pointers which is potentially a long on 64bit.
> 
>     static void audit_cb(struct audit_buffer *ab, void *va)
>     {
>     [...]
>         if (sa->base.error && sa->e)
>             audit_log_format(ab, " offset=%d", sa->e->pos - sa->e->start);
>     }
> 
> Convert this delta to a long for printing.
> 
> Signed-off-by: Andy Whitcroft <apw at canonical.com>
> ---
>  ubuntu/apparmor/policy_interface.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/ubuntu/apparmor/policy_interface.c b/ubuntu/apparmor/policy_interface.c
> index 24277dc..a3a9425 100644
> --- a/ubuntu/apparmor/policy_interface.c
> +++ b/ubuntu/apparmor/policy_interface.c
> @@ -92,13 +92,14 @@ static void aa_audit_init(struct aa_audit_iface *sa, const char *operation,
>  static void audit_cb(struct audit_buffer *ab, void *va)
>  {
>  	struct aa_audit_iface *sa = va;
> +	long len = sa->e->pos - sa->e->start;
>  
>  	if (sa->name)
>  		audit_log_format(ab, " name=%s", sa->name);
>  	if (sa->name2)
>  		audit_log_format(ab, " namespace=%s", sa->name2);
>  	if (sa->base.error && sa->e)
> -		audit_log_format(ab, " offset=%d", sa->e->pos - sa->e->start);
> +		audit_log_format(ab, " offset=%ld", len);
>  }
>  
>  static int aa_audit_iface(struct aa_audit_iface *sa)

ACK

-- 
Tim Gardner tim.gardner at canonical.com




More information about the kernel-team mailing list