summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-05-09 15:50:29 +0900
committerGitHub <noreply@github.com>2022-05-09 15:50:29 +0900
commitdf423851fcc05cf02281d11aab6aee7b476c1c3b (patch)
treef380217d63eb13cdc461dc9fad47fb9ccf293a93 /src/shared
parentb5be9dbebf335450e41e349c5139905ea0bcf3be (diff)
parent3947432eb0c93e5c327310e0b288fa10ddda997a (diff)
downloadsystemd-df423851fcc05cf02281d11aab6aee7b476c1c3b.tar.gz
Merge pull request #23310 from keszybz/suppress-fuzzer-timeouts-and-errors
Suppress fuzzer timeouts and errors
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/bootspec.c2
-rw-r--r--src/shared/calendarspec.c32
-rw-r--r--src/shared/conf-parser.c2
-rw-r--r--src/shared/dissect-image.c52
4 files changed, 43 insertions, 45 deletions
diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c
index 2111a024fb..09eb36eb56 100644
--- a/src/shared/bootspec.c
+++ b/src/shared/bootspec.c
@@ -1016,7 +1016,7 @@ int boot_config_augment_from_loader(
if (!c)
return log_oom();
- STRV_FOREACH_PAIR(a, b, (char**) title_table)
+ STRV_FOREACH_PAIR(a, b, title_table)
if (streq(*a, *i)) {
t = strdup(*b);
if (!t)
diff --git a/src/shared/calendarspec.c b/src/shared/calendarspec.c
index 79fd1359b6..7dfb50b98d 100644
--- a/src/shared/calendarspec.c
+++ b/src/shared/calendarspec.c
@@ -76,26 +76,21 @@ static int component_compare(CalendarComponent * const *a, CalendarComponent * c
}
static void normalize_chain(CalendarComponent **c) {
- CalendarComponent **b, *i, **j, *next;
- size_t n = 0, k;
-
assert(c);
- for (i = *c; i; i = i->next) {
+ size_t n = 0;
+ for (CalendarComponent *i = *c; i; i = i->next) {
n++;
- /*
- * While we're counting the chain, also normalize `stop`
- * so the length of the range is a multiple of `repeat`
- */
+ /* While we're counting the chain, also normalize 'stop'
+ * so the length of the range is a multiple of 'repeat'. */
if (i->stop > i->start && i->repeat > 0)
i->stop -= (i->stop - i->start) % i->repeat;
- /* If a repeat value is specified, but it cannot even be triggered once, let's suppress
- * it.
+ /* If a repeat value is specified, but it cannot even be triggered once, let's suppress it.
*
- * Similar, if the stop value is the same as the start value, then let's just make this a
- * non-repeating chain element */
+ * Similarly, if the stop value is the same as the start value, then let's just make this a
+ * non-repeating chain element. */
if ((i->stop > i->start && i->repeat > 0 && i->start + i->repeat > i->stop) ||
i->start == i->stop) {
i->repeat = 0;
@@ -106,17 +101,18 @@ static void normalize_chain(CalendarComponent **c) {
if (n <= 1)
return;
- j = b = newa(CalendarComponent*, n);
- for (i = *c; i; i = i->next)
+ CalendarComponent **b, **j;
+ b = j = newa(CalendarComponent*, n);
+ for (CalendarComponent *i = *c; i; i = i->next)
*(j++) = i;
typesafe_qsort(b, n, component_compare);
b[n-1]->next = NULL;
- next = b[n-1];
+ CalendarComponent *next = b[n-1];
/* Drop non-unique entries */
- for (k = n-1; k > 0; k--) {
+ for (size_t k = n-1; k > 0; k--) {
if (component_compare(&b[k-1], &next) == 0) {
free(b[k-1]);
continue;
@@ -253,7 +249,7 @@ static void format_weekdays(FILE *f, const CalendarSpec *c) {
"Thu",
"Fri",
"Sat",
- "Sun"
+ "Sun",
};
int l, x;
@@ -408,7 +404,7 @@ static int parse_weekdays(const char **p, CalendarSpec *c) {
{ "Saturday", 5 },
{ "Sat", 5 },
{ "Sunday", 6 },
- { "Sun", 6 }
+ { "Sun", 6 },
};
int l = -1;
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index a84c47cd26..6bd3ab38db 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -497,7 +497,7 @@ static int config_parse_many_files(
}
/* First read the first found main config file. */
- STRV_FOREACH(fn, (char**) conf_files) {
+ STRV_FOREACH(fn, conf_files) {
r = config_parse(NULL, *fn, NULL, sections, lookup, table, flags, userdata, &st);
if (r < 0)
return r;
diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c
index 057fe14125..5b0b12a265 100644
--- a/src/shared/dissect-image.c
+++ b/src/shared/dissect-image.c
@@ -1317,7 +1317,9 @@ static int mount_partition(
if (!fstype)
return -EAFNOSUPPORT;
- /* We are looking at an encrypted partition? This either means stacked encryption, or the caller didn't call dissected_image_decrypt() beforehand. Let's return a recognizable error for this case. */
+ /* We are looking at an encrypted partition? This either means stacked encryption, or the caller
+ * didn't call dissected_image_decrypt() beforehand. Let's return a recognizable error for this
+ * case. */
if (streq(fstype, "crypto_LUKS"))
return -EUNATCH;
@@ -3031,31 +3033,31 @@ int mount_image_privately_interactively(
}
static const char *const partition_designator_table[] = {
- [PARTITION_ROOT] = "root",
- [PARTITION_ROOT_SECONDARY] = "root-secondary",
- [PARTITION_ROOT_OTHER] = "root-other",
- [PARTITION_USR] = "usr",
- [PARTITION_USR_SECONDARY] = "usr-secondary",
- [PARTITION_USR_OTHER] = "usr-other",
- [PARTITION_HOME] = "home",
- [PARTITION_SRV] = "srv",
- [PARTITION_ESP] = "esp",
- [PARTITION_XBOOTLDR] = "xbootldr",
- [PARTITION_SWAP] = "swap",
- [PARTITION_ROOT_VERITY] = "root-verity",
- [PARTITION_ROOT_SECONDARY_VERITY] = "root-secondary-verity",
- [PARTITION_ROOT_OTHER_VERITY] = "root-other-verity",
- [PARTITION_USR_VERITY] = "usr-verity",
- [PARTITION_USR_SECONDARY_VERITY] = "usr-secondary-verity",
- [PARTITION_USR_OTHER_VERITY] = "usr-other-verity",
- [PARTITION_ROOT_VERITY_SIG] = "root-verity-sig",
+ [PARTITION_ROOT] = "root",
+ [PARTITION_ROOT_SECONDARY] = "root-secondary",
+ [PARTITION_ROOT_OTHER] = "root-other",
+ [PARTITION_USR] = "usr",
+ [PARTITION_USR_SECONDARY] = "usr-secondary",
+ [PARTITION_USR_OTHER] = "usr-other",
+ [PARTITION_HOME] = "home",
+ [PARTITION_SRV] = "srv",
+ [PARTITION_ESP] = "esp",
+ [PARTITION_XBOOTLDR] = "xbootldr",
+ [PARTITION_SWAP] = "swap",
+ [PARTITION_ROOT_VERITY] = "root-verity",
+ [PARTITION_ROOT_SECONDARY_VERITY] = "root-secondary-verity",
+ [PARTITION_ROOT_OTHER_VERITY] = "root-other-verity",
+ [PARTITION_USR_VERITY] = "usr-verity",
+ [PARTITION_USR_SECONDARY_VERITY] = "usr-secondary-verity",
+ [PARTITION_USR_OTHER_VERITY] = "usr-other-verity",
+ [PARTITION_ROOT_VERITY_SIG] = "root-verity-sig",
[PARTITION_ROOT_SECONDARY_VERITY_SIG] = "root-secondary-verity-sig",
- [PARTITION_ROOT_OTHER_VERITY_SIG] = "root-other-verity-sig",
- [PARTITION_USR_VERITY_SIG] = "usr-verity-sig",
- [PARTITION_USR_SECONDARY_VERITY_SIG] = "usr-secondary-verity-sig",
- [PARTITION_USR_OTHER_VERITY_SIG] = "usr-other-verity-sig",
- [PARTITION_TMP] = "tmp",
- [PARTITION_VAR] = "var",
+ [PARTITION_ROOT_OTHER_VERITY_SIG] = "root-other-verity-sig",
+ [PARTITION_USR_VERITY_SIG] = "usr-verity-sig",
+ [PARTITION_USR_SECONDARY_VERITY_SIG] = "usr-secondary-verity-sig",
+ [PARTITION_USR_OTHER_VERITY_SIG] = "usr-other-verity-sig",
+ [PARTITION_TMP] = "tmp",
+ [PARTITION_VAR] = "var",
};
int verity_dissect_and_mount(