Use unsigned to avoid undefined behavior in scsipi_{get,put}_tag().
Found by kUBSan.
This commit is contained in:
parent
f4659c41ae
commit
2d958b1323
|
@ -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 @@ scsipi_get_tag(struct scsipi_xfer *xs)
|
|||
#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 @@ scsipi_put_tag(struct scsipi_xfer *xs)
|
|||
word = xs->xs_tag_id >> 5;
|
||||
bit = xs->xs_tag_id & 0x1f;
|
||||
|
||||
periph->periph_freetags[word] |= (1 << bit);
|
||||
periph->periph_freetags[word] |= (1U << bit);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue