]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
import: make check-pointer-deref clean 41370/head
authorMichael Vogt <michael@amutable.com>
Fri, 27 Mar 2026 10:30:32 +0000 (11:30 +0100)
committerMichael Vogt <michael@amutable.com>
Fri, 27 Mar 2026 10:30:32 +0000 (11:30 +0100)
Add the needed assert changes to make the code clean
for the new check-pointer-deref script.

meson.build
src/import/curl-util.c
src/import/import-compress.c
src/import/pull-common.c
src/import/qcow2-util.c

index e6169ad052c2a462df9b16555077b82b91dc390c..5c02ab8664063447fd5dc635a7ef18fd1851f1c8 100644 (file)
@@ -2979,7 +2979,6 @@ if spatch.found()
         coccinelle_exclude = [
                 'src/basic/',
                 'src/core/',
-                'src/import/',
                 'src/journal/',
                 'src/libsystemd/',
                 'src/network/',
index 4747d0993a8c38c72996ee43eb2148850aaf0f7d..bddc93d52b80dc990a8e2b1309c739352f5e22a2 100644 (file)
@@ -359,6 +359,8 @@ int curl_header_strdup(const void *contents, size_t sz, const char *field, char
         const char *p;
         char *s;
 
+        assert(value);
+
         p = memory_startswith_no_case(contents, sz, field);
         if (!p)
                 return 0;
index f893abc43e648efa6a515fc422a06cf352a98bfd..aca4041f2a4164883f93d43f9d9f7b1c3760a929 100644 (file)
@@ -318,6 +318,10 @@ static int enlarge_buffer(void **buffer, size_t *buffer_size, size_t *buffer_all
         size_t l;
         void *p;
 
+        assert(buffer);
+        assert(buffer_size);
+        assert(buffer_allocated);
+
         if (*buffer_allocated > *buffer_size)
                 return 0;
 
index cc06fe4f1db0a755d8b458661d1295c8f83b62c4..c0e0e9907e6b114f3ee11741d3851aa9370a1e85 100644 (file)
@@ -622,6 +622,7 @@ int pull_job_restart_with_sha256sum(PullJob *j, char **ret) {
         int r;
 
         assert(j);
+        assert(ret);
 
         /* Generic implementation of a PullJobNotFound handler, that restarts the job requesting SHA256SUMS */
 
index 77298bcbe29796292df9d8dbe4e104b20cb6d88f..dd5c3c23ecb42cd56103daa518106881db9a78ea 100644 (file)
@@ -150,6 +150,10 @@ static int normalize_offset(
                 bool *compressed,
                 uint64_t *compressed_size) {
 
+        assert(ret);
+        POINTER_MAY_BE_NULL(compressed);
+        POINTER_MAY_BE_NULL(compressed_size);
+
         uint64_t q;
 
         q = be64toh(p);