diff options
| author | kamil <kamil@NetBSD.org> | 2018-07-04 17:50:18 +0000 |
|---|---|---|
| committer | kamil <kamil@NetBSD.org> | 2018-07-04 17:50:18 +0000 |
| commit | b12896d9055bb746feb015903108821837fcdfac (patch) | |
| tree | 75e3817aad705ce7697c5c0d055c2add972d54cd /sys/kern/sys_mqueue.c | |
| parent | 48bbf57b25c8694489ce0e1aed9f04056d98ce9d (diff) | |
Avoid undefined behavior in mq_send1()
Do not shift a signed integer causing change of the signed bit.
sys/kern/sys_mqueue.c:881:23, left shift of 1 by 31 places cannot be represented in type 'int'
Detected with Kernel Undefined Behavior Sanitizer.
Reported by <Harry Pantazis>
Diffstat (limited to 'sys/kern/sys_mqueue.c')
| -rw-r--r-- | sys/kern/sys_mqueue.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/sys_mqueue.c b/sys/kern/sys_mqueue.c index 2ff668dbe98..e5cf39c210b 100644 --- a/sys/kern/sys_mqueue.c +++ b/sys/kern/sys_mqueue.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys_mqueue.c,v 1.41 2018/07/04 17:39:12 kamil Exp $ */ +/* $NetBSD: sys_mqueue.c,v 1.42 2018/07/04 17:50:18 kamil Exp $ */ /* * Copyright (c) 2007-2011 Mindaugas Rasiukevicius <rmind at NetBSD org> @@ -43,7 +43,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sys_mqueue.c,v 1.41 2018/07/04 17:39:12 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_mqueue.c,v 1.42 2018/07/04 17:50:18 kamil Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -878,7 +878,7 @@ mq_send1(mqd_t mqdes, const char *msg_ptr, size_t msg_len, u_int msg_prio, KASSERT(idx != MQ_PQRESQ); TAILQ_INSERT_TAIL(&mq->mq_head[idx], msg, msg_queue); - mq->mq_bitmap |= (1 << --idx); + mq->mq_bitmap |= (1U << --idx); } else { mqueue_linear_insert(mq, msg); } |
