Source-Changes-HG archive

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

[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs/zfs external/cddl/osn...



details:   https://anonhg.NetBSD.org/src/rev/1eb375e52a82
branches:  trunk
changeset: 1008070:1eb375e52a82
user:      fox <fox%NetBSD.org@localhost>
date:      Mon Mar 09 15:37:46 2020 +0000

description:
external/cddl/osnet: Fix possible signed integer overflow

Detected by UBSan and fixed upstream

Cherry-pick:
>From 05852b3467b44cdf88541ec67624cd1f5f2ded1d Mon Sep 17 00:00:00 2001
From: luozhengzheng <luo.zhengzheng%zte.com.cn@localhost>
Date: Fri, 14 Oct 2016 05:25:05 +0800
Subject: [PATCH] Fix coverity defects: CID 147571, 147574

CID 147571: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
CID 147574: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)

Reviewed-by: Brian Behlendorf <behlendorf1%llnl.gov@localhost>
Signed-off-by: luozhengzheng <luo.zhengzheng%zte.com.cn@localhost>
Closes #5268

Reviewed by: kamil@

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/dmu_tx.c |  2 +-
 external/cddl/osnet/dist/uts/common/fs/zfs/spa.c    |  2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 51e7e1b3396a -r 1eb375e52a82 external/cddl/osnet/dist/uts/common/fs/zfs/dmu_tx.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_tx.c       Mon Mar 09 14:45:41 2020 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_tx.c       Mon Mar 09 15:37:46 2020 +0000
@@ -412,7 +412,7 @@
        dnode_t *dn = txh->txh_dnode;
        dnode_t *mdn = DMU_META_DNODE(txh->txh_tx->tx_objset);
        uint64_t space = mdn->dn_datablksz +
-           ((mdn->dn_nlevels-1) << mdn->dn_indblkshift);
+           ((uint64_t)(mdn->dn_nlevels-1) << mdn->dn_indblkshift);
 
        if (dn && dn->dn_dbuf->db_blkptr &&
            dsl_dataset_block_freeable(dn->dn_objset->os_dsl_dataset,
diff -r 51e7e1b3396a -r 1eb375e52a82 external/cddl/osnet/dist/uts/common/fs/zfs/spa.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c  Mon Mar 09 14:45:41 2020 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/spa.c  Mon Mar 09 15:37:46 2020 +0000
@@ -6293,7 +6293,7 @@
        } else {
                config_task_suspended =
                    (gethrtime() - spa->spa_ccw_fail_time) <
-                   (zfs_ccw_retry_interval * NANOSEC);
+                   ((hrtime_t)zfs_ccw_retry_interval * NANOSEC);
        }
 
        return (non_config_tasks || (config_task && !config_task_suspended));



Home | Main Index | Thread Index | Old Index