[apparmor] [patch] Fix dfa minimization

John Johansen john.johansen at canonical.com
Sat Jan 4 11:09:43 UTC 2014


And the patch (yes I died a little with this one, guess what code is now on
my hit list). And yes it is just removing casting from the one line and
changing it in the macro

Signed-off-by: John Johansen <john.johansen at canonical.com>

oh and nominated for the 2.8 series as well

=== modified file 'parser/parser_interface.c'
--- parser/parser_interface.c	2013-10-14 21:37:48 +0000
+++ parser/parser_interface.c	2014-01-04 11:04:09 +0000
@@ -363,7 +363,7 @@
 	return 1;
 }
 
-#define align64(X) (((size_t) (X) + (size_t) 7) & ~((size_t) 7))
+#define align64(X) (((X) + (typeof(X)) 7) & ~((typeof(X)) 7))
 inline int sd_write_aligned_blob(sd_serialize *p, void *b, int buf_size,
 				 const char *name)
 {
@@ -371,7 +371,7 @@
 	u32 tmp;
 	if (!sd_write_name(p, name))
 		return 0;
-	pad = align64(((long)(p->pos + 5) - (long)(p->buffer)) - ((long)(p->pos + 5) - (long)(p->buffer)));
+	pad = align64(p->pos + 5 - p->buffer) - (p->pos + 5 - p->buffer);
 	if (!sd_prepare_write(p, SD_BLOB, 4 + buf_size + pad))
 		return 0;
 	tmp = cpu_to_le32(buf_size + pad);




More information about the AppArmor mailing list