Module Name:    src
Committed By:   riastradh
Date:           Tue Jun 30 04:15:46 UTC 2020

Modified Files:
        src/tests/dev/cgd: t_cgd_adiantum.c

Log Message:
Fix sign-compare issue on 32-bit systems.

Built fine on amd64, where all unsigned values are representable in
ssize_t, but I didn't try building on i386, where they're not.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/cgd/t_cgd_adiantum.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/dev/cgd/t_cgd_adiantum.c
diff -u src/tests/dev/cgd/t_cgd_adiantum.c:1.1 src/tests/dev/cgd/t_cgd_adiantum.c:1.2
--- src/tests/dev/cgd/t_cgd_adiantum.c:1.1	Mon Jun 29 23:44:01 2020
+++ src/tests/dev/cgd/t_cgd_adiantum.c	Tue Jun 30 04:15:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_adiantum.c,v 1.1 2020/06/29 23:44:01 riastradh Exp $	*/
+/*	$NetBSD: t_cgd_adiantum.c,v 1.2 2020/06/30 04:15:46 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -357,7 +357,7 @@ ATF_TC_BODY(cgd_adiantum, tc)
 		/* read the ciphertext out from the underlying file */
 		RL(nread = pread(dkfd, buf, C[i].secsize,
 			C[i].blkno * C[i].secsize));
-		if (nread != C[i].secsize) {
+		if ((size_t)nread != C[i].secsize) {
 			atf_tc_fail_nonfatal("truncated read: %zd != %u",
 			    nread, C[i].secsize);
 			continue;
@@ -375,7 +375,7 @@ ATF_TC_BODY(cgd_adiantum, tc)
 		RL(nread = rump_sys_pread(cgdfd, buf, C[i].secsize,
 			C[i].blkno * C[i].secsize));
 		RL(unconfigure_cgd(cgdfd));
-		if (nread != C[i].secsize) {
+		if ((size_t)nread != C[i].secsize) {
 			atf_tc_fail_nonfatal("truncated read: %zd != %u",
 			    nread, C[i].secsize);
 			continue;

Reply via email to