Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/scsipi Use unsigned to avoid undefined behavior in s...
details: https://anonhg.NetBSD.org/src/rev/4453f35e2753
branches: trunk
changeset: 965487:4453f35e2753
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Thu Sep 19 03:37:31 2019 +0000
description:
Use unsigned to avoid undefined behavior in scsipi_{get,put}_tag().
Found by kUBSan.
diffstat:
sys/dev/scsipi/scsipi_base.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r 300ddcbb2ea3 -r 4453f35e2753 sys/dev/scsipi/scsipi_base.c
--- a/sys/dev/scsipi/scsipi_base.c Thu Sep 19 01:44:48 2019 +0000
+++ b/sys/dev/scsipi/scsipi_base.c Thu Sep 19 03:37:31 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scsipi_base.c,v 1.182 2019/03/28 10:44:29 kardel Exp $ */
+/* $NetBSD: scsipi_base.c,v 1.183 2019/09/19 03:37:31 msaitoh Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.182 2019/03/28 10:44:29 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.183 2019/09/19 03:37:31 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_scsi.h"
@@ -367,7 +367,7 @@
#endif
bit -= 1;
- periph->periph_freetags[word] &= ~(1 << bit);
+ periph->periph_freetags[word] &= ~(1U << bit);
tag = (word << 5) | bit;
/* XXX Should eventually disallow this completely. */
@@ -398,7 +398,7 @@
word = xs->xs_tag_id >> 5;
bit = xs->xs_tag_id & 0x1f;
- periph->periph_freetags[word] |= (1 << bit);
+ periph->periph_freetags[word] |= (1U << bit);
}
/*
Home |
Main Index |
Thread Index |
Old Index