Sun Mar 8 14:09:33 2020 UTC ()
Use unsigned to avoid undefined behavior. Found by kUBSan.


(msaitoh)
diff -r1.4 -r1.5 src/sys/dev/hid/hid.h

cvs diff -r1.4 -r1.5 src/sys/dev/hid/hid.h (expand / switch to unified diff)

--- src/sys/dev/hid/hid.h 2020/03/02 18:15:28 1.4
+++ src/sys/dev/hid/hid.h 2020/03/08 14:09:32 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hid.h,v 1.4 2020/03/02 18:15:28 christos Exp $ */ 1/* $NetBSD: hid.h,v 1.5 2020/03/08 14:09:32 msaitoh Exp $ */
2/* $FreeBSD: src/sys/dev/usb/hid.h,v 1.7 1999/11/17 22:33:40 n_hibma Exp $ */ 2/* $FreeBSD: src/sys/dev/usb/hid.h,v 1.7 1999/11/17 22:33:40 n_hibma Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1998 The NetBSD Foundation, Inc. 5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Lennart Augustsson (lennart@augustsson.net) at 9 * by Lennart Augustsson (lennart@augustsson.net) at
10 * Carlstedt Research & Technology. 10 * Carlstedt Research & Technology.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -113,28 +113,28 @@ int hid_is_collection(const void *, int, @@ -113,28 +113,28 @@ int hid_is_collection(const void *, int,
113#define HUP_UNICODE 0x0010 113#define HUP_UNICODE 0x0010
114#define HUP_ALPHANUM_DISPLAY 0x0014 114#define HUP_ALPHANUM_DISPLAY 0x0014
115#define HUP_MONITOR 0x0080 115#define HUP_MONITOR 0x0080
116#define HUP_MONITOR_ENUM_VAL 0x0081 116#define HUP_MONITOR_ENUM_VAL 0x0081
117#define HUP_VESA_VC 0x0082 117#define HUP_VESA_VC 0x0082
118#define HUP_VESA_CMD 0x0083 118#define HUP_VESA_CMD 0x0083
119#define HUP_POWER 0x0084 119#define HUP_POWER 0x0084
120#define HUP_BATTERY 0x0085 120#define HUP_BATTERY 0x0085
121#define HUP_BARCODE_SCANNER 0x008b 121#define HUP_BARCODE_SCANNER 0x008b
122#define HUP_SCALE 0x008c 122#define HUP_SCALE 0x008c
123#define HUP_CAMERA_CONTROL 0x0090 123#define HUP_CAMERA_CONTROL 0x0090
124#define HUP_ARCADE 0x0091 124#define HUP_ARCADE 0x0091
125#define HUP_VENDOR 0x00ff 125#define HUP_VENDOR 0x00ff
126#define HUP_FIDO 0xf1d0 126#define HUP_FIDO 0xf1d0U
127#define HUP_MICROSOFT 0xff00 127#define HUP_MICROSOFT 0xff00U
128/* XXX compat */ 128/* XXX compat */
129#define HUP_APPLE 0x00ff 129#define HUP_APPLE 0x00ff
130#define HUP_WACOM 0xff00 130#define HUP_WACOM 0xff00
131 131
132/* Usages, Power Device */ 132/* Usages, Power Device */
133#define HUP_INAME 0x0001 133#define HUP_INAME 0x0001
134#define HUP_PRESENT_STATUS 0x0002 134#define HUP_PRESENT_STATUS 0x0002
135#define HUP_CHANGED_STATUS 0x0003 135#define HUP_CHANGED_STATUS 0x0003
136#define HUP_UPS 0x0004 136#define HUP_UPS 0x0004
137#define HUP_POWER_SUPPLY 0x0005 137#define HUP_POWER_SUPPLY 0x0005
138#define HUP_BATTERY_SYSTEM 0x0010 138#define HUP_BATTERY_SYSTEM 0x0010
139#define HUP_BATTERY_SYSTEM_ID 0x0011 139#define HUP_BATTERY_SYSTEM_ID 0x0011
140#define HUP_PD_BATTERY 0x0012 140#define HUP_PD_BATTERY 0x0012