From: Zbigniew Jędrzejewski-Szmek Date: Fri, 15 Mar 2019 10:05:26 +0000 (+0100) Subject: shared/bootspec: avoid signed-unsigned comparison X-Git-Tag: v242-rc1~120^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a75fcef8fb6d70711fabf23df44766c94285822d;p=thirdparty%2Fsystemd.git shared/bootspec: avoid signed-unsigned comparison ../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) | ^~ --- diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index 59930464bc0..af8da15236a 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -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. */