Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/dev/cgd Fix sign-compare issue on 32-bit systems.



details:   https://anonhg.NetBSD.org/src/rev/827e05115de1
branches:  trunk
changeset: 935325:827e05115de1
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Jun 30 04:15:46 2020 +0000

description:
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.

diffstat:

 tests/dev/cgd/t_cgd_adiantum.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 689f4c8ce658 -r 827e05115de1 tests/dev/cgd/t_cgd_adiantum.c
--- a/tests/dev/cgd/t_cgd_adiantum.c    Tue Jun 30 04:14:55 2020 +0000
+++ b/tests/dev/cgd/t_cgd_adiantum.c    Tue Jun 30 04:15:46 2020 +0000
@@ -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 @@
                /* 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 @@
                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;



Home | Main Index | Thread Index | Old Index