Add NVDIMM support Re-written linux interface parser to handle how devices are partitioned better, and for cleaner code, with one file per device type. lots of verbosity updates better CI analysis with clang's analyzer as well as coverity Better handling of immutable bits in sysfs LIBEFIVAR_OPS=help lots of code cleanups. Signed-off-by: Peter Jones <pjones@redhat.com>
80 lines
2.9 KiB
Diff
80 lines
2.9 KiB
Diff
From bc11451222cc77d8c1b4e752167adabd3c7f64c9 Mon Sep 17 00:00:00 2001
|
|
From: Peter Jones <pjones@redhat.com>
|
|
Date: Thu, 21 Jun 2018 13:33:26 -0400
|
|
Subject: [PATCH 20/34] efiboot: Make the device node skipping code pass
|
|
coverity.
|
|
|
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
---
|
|
src/linux.c | 31 ++++++++++++++++++-------------
|
|
1 file changed, 18 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/src/linux.c b/src/linux.c
|
|
index f919dee5b67..6d20c2dbe25 100644
|
|
--- a/src/linux.c
|
|
+++ b/src/linux.c
|
|
@@ -308,7 +308,8 @@ struct device HIDDEN
|
|
{
|
|
struct device *dev;
|
|
char *linkbuf = NULL, *tmpbuf = NULL;
|
|
- unsigned int i, n = 0;
|
|
+ int i = 0;
|
|
+ unsigned int n = 0;
|
|
int rc;
|
|
|
|
size_t nmemb = (sizeof(dev_probes)
|
|
@@ -432,9 +433,11 @@ struct device HIDDEN
|
|
int last_successful_probe = -1;
|
|
|
|
debug("searching for device nodes in %s", dev->link);
|
|
- for (i = 0; dev_probes[i] && dev_probes[i]->parse; i++) {
|
|
+ for (i = 0;
|
|
+ dev_probes[i] && dev_probes[i]->parse && *current;
|
|
+ i++) {
|
|
struct dev_probe *probe = dev_probes[i];
|
|
- ssize_t pos;
|
|
+ int pos;
|
|
|
|
if (!needs_root &&
|
|
(probe->flags & DEV_PROVIDES_ROOT)) {
|
|
@@ -471,24 +474,26 @@ struct device HIDDEN
|
|
debug("dev_probes[i+1]: %p dev->interface_type: %d\n",
|
|
dev_probes[i+1], dev->interface_type);
|
|
if (dev_probes[i+1] == NULL && dev->interface_type == unknown) {
|
|
- int new_pos = 0;
|
|
- rc = sscanf(current, "%*[^/]/%n", &new_pos);
|
|
+ pos = 0;
|
|
+ rc = sscanf(current, "%*[^/]/%n", &pos);
|
|
if (rc < 0) {
|
|
- efi_error(
|
|
- "Cannot parse device link segment \"%s\"",
|
|
- current);
|
|
+slash_err:
|
|
+ efi_error("Cannot parse device link segment \"%s\"", current);
|
|
goto err;
|
|
}
|
|
+
|
|
+ while (current[pos] == '/')
|
|
+ pos += 1;
|
|
+
|
|
+ if (!current[pos])
|
|
+ goto slash_err;
|
|
+
|
|
debug("Cannot parse device link segment \"%s\"", current);
|
|
debug("Skipping to \"%s\"", current + pos);
|
|
debug("This means we can only create abbreviated paths");
|
|
- if (rc < 0)
|
|
- goto err;
|
|
- if (new_pos == 0)
|
|
- goto err;
|
|
dev->flags |= DEV_ABBREV_ONLY;
|
|
i = last_successful_probe;
|
|
- current += new_pos;
|
|
+ current += pos;
|
|
}
|
|
}
|
|
|
|
--
|
|
2.17.1
|
|
|