From ffba064ae4d178b95733aed7c795ad799ddec2c4 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 25 Jun 2019 11:36:51 +0900 Subject: [PATCH] linux: make UBSAN quiet --- src/shared/linux/README | 1 + src/shared/linux/ethtool.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shared/linux/README b/src/shared/linux/README index 38782338b05..46d554764d3 100644 --- a/src/shared/linux/README +++ b/src/shared/linux/README @@ -5,3 +5,4 @@ The files in this directory are copied from kernel-5.2, and the following modifi - bpf_insn.h: BPF_JMP_A() macro is also imported from include/linux/filter.h - dm-ioctl.h: set DM_VERSION_MINOR to 27 - ethtool.h: define __KERNEL_DIV_ROUND_UP if not defined +- ethtool.h: add casts in ethtool_cmd_speed() diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h index 742f2fbf3e1..acf346be41e 100644 --- a/src/shared/linux/ethtool.h +++ b/src/shared/linux/ethtool.h @@ -126,7 +126,7 @@ static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) { - return (ep->speed_hi << 16) | ep->speed; + return ((__u32) ep->speed_hi << 16) | (__u32) ep->speed; } /* Device supports clause 22 register access to PHY or peripherals -- 2.47.3