Ignore completely bogus GCC 11 warnings.

Various varieties of this:

           |   45 |   tempfile = strdup ("/tmp/luksXXXXXX");
           |      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~
           |      |              |
           |      |              (19) this call could return NULL
           |   46 |   if (!tempfile) {
           |      |      ~
           |      |      |
           |      |      (20) following 'false' branch (when 'tempfile' is non-NULL)...
           |......
           |   51 |   fd = mkstemp (tempfile);
           |      |   ~~   ~~~~~~~~~~~~~~~~~~
           |      |   |    |
           |      |   |    (22) argument 1 ('tempfile') from (19) could be NULL where non-null expected
           |      |   (21) ...to here
This commit is contained in:
Richard W.M. Jones
2021-01-05 10:13:27 +00:00
parent 07585189cf
commit 4bbbf03b8b
4 changed files with 12 additions and 0 deletions

View File

@@ -34,6 +34,8 @@ optgroup_luks_available (void)
return prog_exists ("cryptsetup");
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-possible-null-argument"
/* Callers must also call remove_temp (tempfile). */
static char *
write_key_to_temp (const char *key)
@@ -73,6 +75,7 @@ write_key_to_temp (const char *key)
free (tempfile);
return NULL;
}
#pragma GCC diagnostic pop
static void
remove_temp (char *tempfile)

View File

@@ -30,6 +30,8 @@
#include "actions.h"
#include "optgroups.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-null-argument"
/* Read the error file. Returns a string that the caller must free. */
static char *
read_error_file (char *error_file)
@@ -51,6 +53,7 @@ read_error_file (char *error_file)
return str; /* caller frees */
}
#pragma GCC diagnostic pop
static int
write_cb (void *fd_ptr, const void *buf, size_t len)

View File

@@ -313,6 +313,8 @@ main (int argc, char *argv[])
exit (err == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-null-argument"
/* Generate a display name for the single guest mode. See comments in
* https://bugzilla.redhat.com/show_bug.cgi?id=880801
*/
@@ -370,6 +372,7 @@ single_drive_display_name (struct drv *drvs)
return name;
}
#pragma GCC diagnostic pop
static char *
make_display_name (struct drv *drvs)

View File

@@ -302,6 +302,8 @@ main (int argc, char *argv[])
exit (EXIT_SUCCESS);
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-null-argument"
/* Parse lvm string of the form "/dev/VG/LV" or "VG/LV".
* This sets the global variables 'vg' and 'lv', or exits on failure.
*/
@@ -327,6 +329,7 @@ parse_vg_lv (const char *lvm)
if (strchr (vg, '/') || strchr (lv, '/'))
goto cannot_parse;
}
#pragma GCC diagnostic pop
/* Returns 0 on success, 1 if we need to retry. */
static int