From 7f6ebecd56e690012b05af0a492280765b17f186 Mon Sep 17 00:00:00 2001 From: "Guillermo E. Martinez" Date: Fri, 3 Feb 2023 11:17:49 -0600 Subject: bpf: fix error conversion from long unsigned int to unsigned int [-Werror=overflow] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regenerating BPF target using the maintainer mode emits: .../opcodes/bpf-opc.c:57:11: error: conversion from ‘long unsigned int’ to ‘unsigned int’ changes value from ‘18446744073709486335’ to ‘4294902015’ [-Werror=overflow] 57 | 64, 64, 0xffffffffffff00ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } } The use of a narrow size to handle the mask CGEN in instruction format is causing this error. Additionally eBPF `call' instructions constructed by expressions using symbols (BPF_PSEUDO_CALL) emits annotations in `src' field of the instruction, used to identify BPF target endianness. cpu/ * bpf.cpu (define-call-insn): Remove `src' field from instruction mask. include/ *opcode/cge.h (CGEN_IFMT): Adjust mask bit width. opcodes/ * bpf-opc.c: Regenerate. --- opcodes/cgen-dis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'opcodes/cgen-dis.c') diff --git a/opcodes/cgen-dis.c b/opcodes/cgen-dis.c index de315d9..90746a8 100644 --- a/opcodes/cgen-dis.c +++ b/opcodes/cgen-dis.c @@ -39,7 +39,7 @@ static void add_insn_to_hash_chain (CGEN_INSN_LIST *, static int count_decodable_bits (const CGEN_INSN *insn) { - unsigned mask = CGEN_INSN_BASE_MASK (insn); + CGEN_INSN_LGUINT mask = CGEN_INSN_BASE_MASK (insn); #if GCC_VERSION >= 3004 return __builtin_popcount (mask); #else -- cgit v1.1