LCOV - code coverage report
Current view: top level - bpfilter/cgen - jmp.c (source / functions) Coverage Total Hit
Test: lcov.out Lines: 87.5 % 8 7
Test Date: 2025-09-30 16:37:25 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 "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/logger.h>
      15              : 
      16              : #include "cgen/program.h"
      17              : 
      18           19 : void bf_jmpctx_cleanup(struct bf_jmpctx *ctx)
      19              : {
      20           19 :     if (ctx->program) {
      21           19 :         struct bpf_insn *insn = &ctx->program->img[ctx->insn_idx];
      22           19 :         size_t off = ctx->program->img_size - ctx->insn_idx - 1U;
      23              : 
      24           19 :         if (off > SHRT_MAX)
      25            0 :             bf_warn("jump offset overflow: %ld", off);
      26              : 
      27           19 :         insn->off = (int16_t)off;
      28              :     }
      29           19 : }
        

Generated by: LCOV version 2.0-1