]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/bootspec: avoid signed-unsigned comparison
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 15 Mar 2019 10:05:26 +0000 (11:05 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 15 Mar 2019 14:28:43 +0000 (15:28 +0100)
../src/shared/bootspec.c: In function ‘find_sections’:
../src/shared/bootspec.c:425:23: warning: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘int’} and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
  425 |                 if (n != size)
      |                       ^~

src/shared/bootspec.c

index 59930464bc080ade3ab51a2f3fd789b9dff24c7d..af8da15236a9bcf799e0778dc2021a618ad97d39 100644 (file)
@@ -422,7 +422,7 @@ static int find_sections(
                 n = pread(fd, k, size, offset);
                 if (n < 0)
                         return log_error_errno(errno, "Failed to read section payload: %m");
-                if (n != size)
+                if ((size_t) n != size)
                         return log_error_errno(SYNTHETIC_ERRNO(EIO), "Short read while reading section payload, refusing:");
 
                 /* Allow one trailing NUL byte, but nothing more. */