aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/byteorder.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/byteorder.h')
-rw-r--r--sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/byteorder.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/byteorder.h b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/byteorder.h
index d4227ddc5465..bd6728820ed4 100644
--- a/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/byteorder.h
+++ b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/byteorder.h
@@ -6,7 +6,7 @@
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
+ * or https://opensource.org/licenses/CDDL-1.0.
* See the License for the specific language governing permissions
* and limitations under the License.
*
@@ -59,6 +59,18 @@ extern "C" {
*/
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
+#ifdef __COVERITY__
+/*
+ * Coverity's taint warnings from byteswapping are false positives for us.
+ * Suppress them by hiding byteswapping from Coverity.
+ */
+#define BSWAP_8(x) ((x) & 0xff)
+#define BSWAP_16(x) ((x) & 0xffff)
+#define BSWAP_32(x) ((x) & 0xffffffff)
+#define BSWAP_64(x) (x)
+
+#else /* __COVERITY__ */
+
/*
* Macros to reverse byte order
*/
@@ -67,6 +79,8 @@ extern "C" {
#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16))
#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32))
+#endif /* __COVERITY__ */
+
#define BMASK_8(x) ((x) & 0xff)
#define BMASK_16(x) ((x) & 0xffff)
#define BMASK_32(x) ((x) & 0xffffffff)