Skip to content
Snippets Groups Projects
  • Guillermo E. Martinez's avatar
    7f6ebecd
    bpf: fix error conversion from long unsigned int to unsigned int [-Werror=overflow] · 7f6ebecd
    Guillermo E. Martinez authored
    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.
    7f6ebecd
    History
    bpf: fix error conversion from long unsigned int to unsigned int [-Werror=overflow]
    Guillermo E. Martinez authored
    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.