Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/fstyp Explicitly cast offset calculation, size_t ma...



details:   https://anonhg.NetBSD.org/src/rev/437a9c55be67
branches:  trunk
changeset: 949352:437a9c55be67
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jan 10 13:44:57 2021 +0000

description:
Explicitly cast offset calculation, size_t may be smaller than off_t.

diffstat:

 usr.sbin/fstyp/hammer2.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 9b7317fa1d9e -r 437a9c55be67 usr.sbin/fstyp/hammer2.c
--- a/usr.sbin/fstyp/hammer2.c  Sun Jan 10 13:17:44 2021 +0000
+++ b/usr.sbin/fstyp/hammer2.c  Sun Jan 10 13:44:57 2021 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: hammer2.c,v 1.7 2021/01/10 12:38:40 tkusumi Exp $      */
+/*        $NetBSD: hammer2.c,v 1.8 2021/01/10 13:44:57 martin Exp $      */
 
 /*-
  * Copyright (c) 2017-2019 The DragonFly Project
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hammer2.c,v 1.7 2021/01/10 12:38:40 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hammer2.c,v 1.8 2021/01/10 13:44:57 martin Exp $");
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -145,7 +145,7 @@
 
        io_off = bref->data_off & ~HAMMER2_OFF_MASK_RADIX;
        io_base = io_off & ~(hammer2_off_t)(HAMMER2_LBUFSIZE - 1);
-       boff = io_off - io_base;
+       boff = (size_t)((hammer2_off_t)io_off - io_base);
 
        io_bytes = HAMMER2_LBUFSIZE;
        while (io_bytes + boff < bytes)



Home | Main Index | Thread Index | Old Index