Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'landlock-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux

Pull landlock updates from Mickaël Salaün:
"One test fix and a __counted_by annotation"

* tag 'landlock-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux:
selftests/landlock: Fix a resource leak
landlock: Annotate struct landlock_rule with __counted_by

+6 -4
+1 -1
security/landlock/ruleset.h
··· 67 67 * @layers: Stack of layers, from the latest to the newest, implemented 68 68 * as a flexible array member (FAM). 69 69 */ 70 - struct landlock_layer layers[]; 70 + struct landlock_layer layers[] __counted_by(num_layers); 71 71 }; 72 72 73 73 /**
+5 -3
tools/testing/selftests/landlock/fs_test.c
··· 113 113 { 114 114 char str[32]; 115 115 int len; 116 - bool res; 116 + bool res = true; 117 117 FILE *const inf = fopen("/proc/filesystems", "r"); 118 118 119 119 /* ··· 125 125 126 126 /* filesystem can be null for bind mounts. */ 127 127 if (!filesystem) 128 - return true; 128 + goto out; 129 129 130 130 len = snprintf(str, sizeof(str), "nodev\t%s\n", filesystem); 131 131 if (len >= sizeof(str)) 132 132 /* Ignores too-long filesystem names. */ 133 - return true; 133 + goto out; 134 134 135 135 res = fgrep(inf, str); 136 + 137 + out: 136 138 fclose(inf); 137 139 return res; 138 140 }