Merge tag 'selinux-pr-20170831' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / scripts / selinux / genheaders / genheaders.c
index 6a24569c3578af93673cdd40372fdd6224638de9..672b069dcfea4b2945d07b1de74afc8203c1a6a0 100644 (file)
@@ -129,11 +129,16 @@ int main(int argc, char *argv[])
        for (i = 0; secclass_map[i].name; i++) {
                struct security_class_mapping *map = &secclass_map[i];
                for (j = 0; map->perms[j]; j++) {
+                       if (j >= 32) {
+                               fprintf(stderr, "Too many permissions to fit into an access vector at (%s, %s).\n",
+                                       map->name, map->perms[j]);
+                               exit(5);
+                       }
                        fprintf(fout, "#define %s__%s", map->name,
                                map->perms[j]);
                        for (k = 0; k < max(1, 40 - strlen(map->name) - strlen(map->perms[j])); k++)
                                fprintf(fout, " ");
-                       fprintf(fout, "0x%08xUL\n", (1<<j));
+                       fprintf(fout, "0x%08xU\n", (1<<j));
                }
        }