LCOV - code coverage report
Current view: top level - bpfilter/cgen - jmp.c (source / functions) Coverage Total Hit
Test: lcov.out Lines: 85.7 % 7 6
Test Date: 2025-02-26 17:59:59 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /* SPDX-License-Identifier: GPL-2.0-only */
       2              : /*
       3              :  * Copyright (c) 2023 Meta Platforms, Inc. and affiliates.
       4              :  */
       5              : 
       6              : #include "bpfilter/cgen/jmp.h"
       7              : 
       8              : #include <linux/bpf.h>
       9              : 
      10              : #include <limits.h>
      11              : #include <stddef.h>
      12              : #include <stdint.h>
      13              : 
      14              : #include "bpfilter/cgen/program.h"
      15              : #include "core/logger.h"
      16              : 
      17           19 : void bf_jmpctx_cleanup(struct bf_jmpctx *ctx)
      18              : {
      19           19 :     struct bpf_insn *insn = &ctx->program->img[ctx->insn_idx];
      20           19 :     size_t off = ctx->program->img_size - ctx->insn_idx - 1U;
      21              : 
      22           19 :     if (off > SHRT_MAX)
      23            0 :         bf_warn("jump offset overflow: %ld", off);
      24              : 
      25           19 :     insn->off = (int16_t)off;
      26           19 : }
        

Generated by: LCOV version 2.0-1